@storybook/react 6.5.7 → 7.0.0-alpha.0
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/README.md +1 -47
- package/dist/cjs/config.js +51 -0
- package/dist/cjs/{client/docs → docs}/config.js +0 -0
- package/dist/cjs/{client/docs → docs}/extractArgTypes.js +0 -0
- package/dist/cjs/{client/docs → docs}/extractProps.js +0 -0
- package/dist/cjs/{client/docs → docs}/jsxDecorator.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/captions.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/componentTypes.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createDefaultValue.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createFromRawDefaultProp.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateArray.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateObject.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/prettyIdentifier.js +8 -8
- package/dist/cjs/{client/docs → docs}/lib/generateCode.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/acornParser.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/inspectValue.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/types.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/isHtmlTag.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/createType.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/generateFuncSignature.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/handleProp.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/rawDefaultPropResolvers.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/sortProps.js +0 -0
- package/dist/cjs/{client/docs → docs}/react-argtypes.stories.js +0 -0
- package/dist/cjs/{client/docs → docs}/typeScript/handleProp.js +0 -0
- package/dist/cjs/{client/index.js → index.js} +4 -3
- package/dist/cjs/{client/preview → preview}/config.js +1 -7
- package/dist/cjs/{client/preview → preview}/globals.js +0 -0
- package/dist/cjs/{client/preview → preview}/index.js +2 -2
- package/dist/cjs/preview/render.js +310 -0
- package/dist/cjs/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types-6-3.js +0 -0
- package/dist/cjs/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types.js +0 -0
- package/dist/cjs/{client/testing → testing}/index.js +0 -0
- package/dist/esm/config.js +6 -0
- package/dist/{modern/client → esm}/docs/config.js +0 -0
- package/dist/{modern/client → esm}/docs/extractArgTypes.js +0 -1
- package/dist/{modern/client → esm}/docs/extractProps.js +0 -0
- package/dist/{modern/client → esm}/docs/jsxDecorator.js +11 -18
- package/dist/{modern/client → esm}/docs/lib/captions.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/componentTypes.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createDefaultValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createFromRawDefaultProp.js +1 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateArray.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateObject.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/defaultValues/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/prettyIdentifier.js +6 -6
- package/dist/{modern/client → esm}/docs/lib/generateCode.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/acornParser.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/inspection/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/inspectValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/types.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/isHtmlTag.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/createType.js +0 -1
- package/dist/{modern/client → esm}/docs/propTypes/generateFuncSignature.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/handleProp.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/rawDefaultPropResolvers.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/sortProps.js +0 -0
- package/dist/{modern/client → esm}/docs/react-argtypes.stories.js +0 -0
- package/dist/{modern/client → esm}/docs/typeScript/handleProp.js +0 -0
- package/dist/{modern/client → esm}/index.js +2 -4
- package/dist/esm/preview/config.js +1 -0
- package/dist/{modern/client → esm}/preview/globals.js +0 -0
- package/dist/{modern/client → esm}/preview/index.js +1 -1
- package/dist/{modern/client → esm}/preview/render.js +2 -2
- package/dist/esm/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types-6-3.js +0 -0
- package/dist/esm/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types.js +0 -0
- package/dist/{modern/client → esm}/testing/index.js +0 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/{ts3.9/client → types}/docs/config.d.ts +1 -1
- package/dist/{ts3.9/client → types}/docs/extractArgTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/extractProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/jsxDecorator.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/captions.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/componentTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createDefaultValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateArray.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateObject.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/prettyIdentifier.d.ts +1 -1
- package/dist/{ts3.9/client → types}/docs/lib/generateCode.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/acornParser.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/inspectValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/isHtmlTag.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/createType.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/generateFuncSignature.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/sortProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/react-argtypes.stories.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/typeScript/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/index.d.ts +0 -0
- package/dist/types/preview/config.d.ts +1 -0
- package/dist/{ts3.9/client → types}/preview/globals.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/render.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-3.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-7-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/testing/index.d.ts +1 -1
- package/package.json +17 -61
- package/preview.js +1 -0
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/demo.d.ts +0 -32
- package/demo.js +0 -5
- package/dist/cjs/client/preview/render.js +0 -296
- package/dist/cjs/demo/Button.js +0 -37
- package/dist/cjs/demo/Welcome.js +0 -126
- package/dist/cjs/server/build.js +0 -9
- package/dist/cjs/server/cra-config.js +0 -69
- package/dist/cjs/server/framework-preset-cra.js +0 -35
- package/dist/cjs/server/framework-preset-react-docs.js +0 -68
- package/dist/cjs/server/framework-preset-react-dom-hack.js +0 -31
- package/dist/cjs/server/framework-preset-react.js +0 -98
- package/dist/cjs/server/index.js +0 -9
- package/dist/cjs/server/options.js +0 -17
- package/dist/cjs/server/preset.js +0 -16
- package/dist/esm/client/docs/config.js +0 -16
- package/dist/esm/client/docs/extractArgTypes.js +0 -39
- package/dist/esm/client/docs/extractProps.js +0 -54
- package/dist/esm/client/docs/jsxDecorator.js +0 -218
- package/dist/esm/client/docs/lib/captions.js +0 -6
- package/dist/esm/client/docs/lib/componentTypes.js +0 -9
- package/dist/esm/client/docs/lib/defaultValues/createDefaultValue.js +0 -67
- package/dist/esm/client/docs/lib/defaultValues/createFromRawDefaultProp.js +0 -191
- package/dist/esm/client/docs/lib/defaultValues/generateArray.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/generateObject.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/prettyIdentifier.js +0 -22
- package/dist/esm/client/docs/lib/generateCode.js +0 -68
- package/dist/esm/client/docs/lib/inspection/acornParser.js +0 -213
- package/dist/esm/client/docs/lib/inspection/inspectValue.js +0 -16
- package/dist/esm/client/docs/lib/inspection/types.js +0 -12
- package/dist/esm/client/docs/lib/isHtmlTag.js +0 -6
- package/dist/esm/client/docs/propTypes/createType.js +0 -449
- package/dist/esm/client/docs/propTypes/generateFuncSignature.js +0 -62
- package/dist/esm/client/docs/propTypes/handleProp.js +0 -39
- package/dist/esm/client/docs/propTypes/rawDefaultPropResolvers.js +0 -32
- package/dist/esm/client/docs/propTypes/sortProps.js +0 -24
- package/dist/esm/client/docs/react-argtypes.stories.js +0 -97
- package/dist/esm/client/docs/typeScript/handleProp.js +0 -27
- package/dist/esm/client/index.js +0 -7
- package/dist/esm/client/preview/config.js +0 -4
- package/dist/esm/client/preview/globals.js +0 -6
- package/dist/esm/client/preview/index.js +0 -29
- package/dist/esm/client/preview/render.js +0 -255
- package/dist/esm/client/testing/index.js +0 -96
- package/dist/esm/demo/Button.js +0 -26
- package/dist/esm/demo/Welcome.js +0 -114
- package/dist/esm/server/build.js +0 -3
- package/dist/esm/server/cra-config.js +0 -49
- package/dist/esm/server/framework-preset-cra.js +0 -25
- package/dist/esm/server/framework-preset-react-docs.js +0 -49
- package/dist/esm/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/esm/server/framework-preset-react.js +0 -78
- package/dist/esm/server/index.js +0 -3
- package/dist/esm/server/options.js +0 -8
- package/dist/esm/server/preset.js +0 -5
- package/dist/modern/client/docs/lib/defaultValues/index.js +0 -2
- package/dist/modern/client/docs/lib/index.js +0 -4
- package/dist/modern/client/docs/lib/inspection/index.js +0 -2
- package/dist/modern/client/preview/config.js +0 -4
- package/dist/modern/client/preview/types-6-0.js +0 -1
- package/dist/modern/client/preview/types-6-3.js +0 -10
- package/dist/modern/client/preview/types-7-0.js +0 -1
- package/dist/modern/client/preview/types.js +0 -1
- package/dist/modern/demo/Button.js +0 -25
- package/dist/modern/demo/Welcome.js +0 -108
- package/dist/modern/server/build.js +0 -3
- package/dist/modern/server/cra-config.js +0 -49
- package/dist/modern/server/framework-preset-cra.js +0 -25
- package/dist/modern/server/framework-preset-react-docs.js +0 -49
- package/dist/modern/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/modern/server/framework-preset-react.js +0 -78
- package/dist/modern/server/index.js +0 -3
- package/dist/modern/server/options.js +0 -8
- package/dist/modern/server/preset.js +0 -5
- package/dist/ts3.4/client/docs/config.d.ts +0 -13
- package/dist/ts3.4/client/docs/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/extractProps.d.ts +0 -5
- package/dist/ts3.4/client/docs/jsxDecorator.d.ts +0 -23
- package/dist/ts3.4/client/docs/lib/captions.d.ts +0 -6
- package/dist/ts3.4/client/docs/lib/componentTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createDefaultValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -11
- package/dist/ts3.4/client/docs/lib/defaultValues/generateArray.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/generateObject.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/prettyIdentifier.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/generateCode.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/index.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/inspection/acornParser.d.ts +0 -7
- package/dist/ts3.4/client/docs/lib/inspection/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/inspectValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/types.d.ts +0 -50
- package/dist/ts3.4/client/docs/lib/isHtmlTag.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/createType.d.ts +0 -2
- package/dist/ts3.4/client/docs/propTypes/generateFuncSignature.d.ts +0 -4
- package/dist/ts3.4/client/docs/propTypes/handleProp.d.ts +0 -5
- package/dist/ts3.4/client/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/sortProps.d.ts +0 -4
- package/dist/ts3.4/client/docs/react-argtypes.stories.d.ts +0 -1
- package/dist/ts3.4/client/docs/typeScript/handleProp.d.ts +0 -3
- package/dist/ts3.4/client/index.d.ts +0 -4
- package/dist/ts3.4/client/preview/config.d.ts +0 -4
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -25
- package/dist/ts3.4/client/preview/render.d.ts +0 -5
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -35
- package/dist/ts3.4/client/preview/types-6-3.d.ts +0 -40
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -21
- package/dist/ts3.4/client/preview/types.d.ts +0 -16
- package/dist/ts3.4/client/testing/index.d.ts +0 -84
- package/dist/ts3.4/demo/Button.d.ts +0 -4
- package/dist/ts3.4/demo/Welcome.d.ts +0 -6
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/cra-config.d.ts +0 -4
- package/dist/ts3.4/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.4/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.4/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.4/server/index.d.ts +0 -1
- package/dist/ts3.4/server/options.d.ts +0 -3
- package/dist/ts3.4/server/preset.d.ts +0 -3
- package/dist/ts3.9/client/preview/config.d.ts +0 -4
- package/dist/ts3.9/demo/Button.d.ts +0 -4
- package/dist/ts3.9/demo/Welcome.d.ts +0 -6
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/cra-config.d.ts +0 -4
- package/dist/ts3.9/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.9/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.9/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.9/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.9/server/index.d.ts +0 -1
- package/dist/ts3.9/server/options.d.ts +0 -3
- package/dist/ts3.9/server/preset.d.ts +0 -3
- package/preset.js +0 -1
- package/standalone.js +0 -8
- package/types/index.ts +0 -19
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
package/dist/esm/server/build.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import semver from '@storybook/semver';
|
|
4
|
-
import { logger } from '@storybook/node-logger';
|
|
5
|
-
var appDirectory = fs.realpathSync(process.cwd());
|
|
6
|
-
var reactScriptsPath;
|
|
7
|
-
export function getReactScriptsPath({
|
|
8
|
-
noCache: noCache
|
|
9
|
-
} = {}) {
|
|
10
|
-
if (reactScriptsPath && !noCache) return reactScriptsPath;
|
|
11
|
-
var reactScriptsScriptPath = fs.realpathSync(path.join(appDirectory, '/node_modules/.bin/react-scripts'));
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// Note: Since there is no symlink for .bin/react-scripts on Windows
|
|
15
|
-
// we'll parse react-scripts file to find actual package path.
|
|
16
|
-
// This is important if you use fork of CRA.
|
|
17
|
-
var pathIsNotResolved = /node_modules[\\/]\.bin[\\/]react-scripts/i.test(reactScriptsScriptPath);
|
|
18
|
-
|
|
19
|
-
if (pathIsNotResolved) {
|
|
20
|
-
var content = fs.readFileSync(reactScriptsScriptPath, 'utf8');
|
|
21
|
-
var packagePathMatch = content.match(/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i);
|
|
22
|
-
|
|
23
|
-
if (packagePathMatch && packagePathMatch.length > 1) {
|
|
24
|
-
reactScriptsScriptPath = path.join(appDirectory, '/node_modules/.bin/', packagePathMatch[1]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} catch (e) {
|
|
28
|
-
logger.warn(`Error occurred during react-scripts package path resolving: ${e}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
reactScriptsPath = path.join(reactScriptsScriptPath, '../..');
|
|
32
|
-
var scriptsPkgJson = path.join(reactScriptsPath, 'package.json');
|
|
33
|
-
|
|
34
|
-
if (!fs.existsSync(scriptsPkgJson)) {
|
|
35
|
-
reactScriptsPath = 'react-scripts';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return reactScriptsPath;
|
|
39
|
-
}
|
|
40
|
-
export function isReactScriptsInstalled(requiredVersion = '2.0.0') {
|
|
41
|
-
try {
|
|
42
|
-
// eslint-disable-next-line import/no-dynamic-require,global-require
|
|
43
|
-
var reactScriptsJson = require(path.join(getReactScriptsPath(), 'package.json'));
|
|
44
|
-
|
|
45
|
-
return !semver.gtr(requiredVersion, reactScriptsJson.version);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { logger } from '@storybook/node-logger';
|
|
2
|
-
import { isReactScriptsInstalled } from './cra-config';
|
|
3
|
-
|
|
4
|
-
var checkForNewPreset = function (presetsList) {
|
|
5
|
-
var hasNewPreset = presetsList.some(function (preset) {
|
|
6
|
-
var presetName = typeof preset === 'string' ? preset : preset.name;
|
|
7
|
-
return /@storybook(\/|\\)preset-create-react-app/.test(presetName);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
if (!hasNewPreset) {
|
|
11
|
-
logger.warn('Storybook support for Create React App is now a separate preset.');
|
|
12
|
-
logger.warn('To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file.');
|
|
13
|
-
logger.warn('The built-in preset has been disabled in Storybook 6.0.');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function webpackFinal(config, {
|
|
18
|
-
presetsList: presetsList
|
|
19
|
-
}) {
|
|
20
|
-
if (isReactScriptsInstalled()) {
|
|
21
|
-
checkForNewPreset(presetsList);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return config;
|
|
25
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import "core-js/modules/es.promise.js";
|
|
8
|
-
import { findDistEsm } from '@storybook/core-common';
|
|
9
|
-
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
|
|
10
|
-
import { hasDocsOrControls } from '@storybook/docs-tools';
|
|
11
|
-
export async function babel(config, options) {
|
|
12
|
-
if (!hasDocsOrControls(options)) return config;
|
|
13
|
-
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
14
|
-
var reactDocgen = typescriptOptions.reactDocgen;
|
|
15
|
-
|
|
16
|
-
if (typeof reactDocgen !== 'string') {
|
|
17
|
-
return config;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
21
|
-
overrides: [...((config === null || config === void 0 ? void 0 : config.overrides) || []), {
|
|
22
|
-
test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/,
|
|
23
|
-
plugins: [[require.resolve('babel-plugin-react-docgen'), {
|
|
24
|
-
DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
|
|
25
|
-
}]]
|
|
26
|
-
}]
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export async function webpackFinal(config, options) {
|
|
30
|
-
if (!hasDocsOrControls(options)) return config;
|
|
31
|
-
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
32
|
-
var reactDocgen = typescriptOptions.reactDocgen,
|
|
33
|
-
reactDocgenTypescriptOptions = typescriptOptions.reactDocgenTypescriptOptions;
|
|
34
|
-
|
|
35
|
-
if (reactDocgen !== 'react-docgen-typescript') {
|
|
36
|
-
return config;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
40
|
-
plugins: [...config.plugins, new ReactDocgenTypescriptPlugin(_objectSpread(_objectSpread({}, reactDocgenTypescriptOptions), {}, {
|
|
41
|
-
// We *need* this set so that RDT returns default values in the same format as react-docgen
|
|
42
|
-
savePropValueAsString: true
|
|
43
|
-
}))]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
export var previewAnnotations = function (entry = [], options) {
|
|
47
|
-
if (!hasDocsOrControls(options)) return entry;
|
|
48
|
-
return [...entry, findDistEsm(__dirname, 'client/docs/config')];
|
|
49
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import "core-js/modules/es.promise.js";
|
|
8
|
-
import { readJSON } from 'fs-extra';
|
|
9
|
-
import { IgnorePlugin } from 'webpack'; // this is a hack to allow importing react-dom/client even when it's not available
|
|
10
|
-
// this should be removed once we drop support for react-dom < 18
|
|
11
|
-
|
|
12
|
-
export async function webpackFinal(config) {
|
|
13
|
-
var reactDomPkg = await readJSON(require.resolve('react-dom/package.json'));
|
|
14
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
15
|
-
plugins: [...config.plugins, reactDomPkg.version.startsWith('18') || reactDomPkg.version.startsWith('0.0.0') ? null : new IgnorePlugin({
|
|
16
|
-
resourceRegExp: /react-dom\/client$/,
|
|
17
|
-
contextRegExp: /(app\/react|app\\react|@storybook\/react|@storybook\\react)/ // TODO this needs to work for both in our MONOREPO and in the user's NODE_MODULES
|
|
18
|
-
|
|
19
|
-
})].filter(Boolean)
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import "core-js/modules/es.promise.js";
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
10
|
-
import { logger } from '@storybook/node-logger';
|
|
11
|
-
export async function babel(config, options) {
|
|
12
|
-
var isDevelopment = options.configType === 'DEVELOPMENT';
|
|
13
|
-
var reactOptions = await options.presets.apply('reactOptions', {}, options);
|
|
14
|
-
var fastRefreshEnabled = isDevelopment && (reactOptions.fastRefresh || process.env.FAST_REFRESH === 'true');
|
|
15
|
-
|
|
16
|
-
if (!fastRefreshEnabled) {
|
|
17
|
-
return config;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
21
|
-
plugins: [[require.resolve('react-refresh/babel'), {}, 'storybook-react-refresh'], ...(config.plugins || [])]
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
var storybookReactDirName = path.dirname(require.resolve('@storybook/react/package.json')); // TODO: improve node_modules detection
|
|
25
|
-
|
|
26
|
-
var context = storybookReactDirName.includes('node_modules') ? path.join(storybookReactDirName, '../../') // Real life case, already in node_modules
|
|
27
|
-
: path.join(storybookReactDirName, '../../node_modules'); // SB Monorepo
|
|
28
|
-
|
|
29
|
-
var hasJsxRuntime = function () {
|
|
30
|
-
try {
|
|
31
|
-
require.resolve('react/jsx-runtime', {
|
|
32
|
-
paths: [context]
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
} catch (e) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export async function babelDefault(config) {
|
|
42
|
-
var presetReactOptions = hasJsxRuntime() ? {
|
|
43
|
-
runtime: 'automatic'
|
|
44
|
-
} : {};
|
|
45
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
46
|
-
presets: [...((config === null || config === void 0 ? void 0 : config.presets) || []), [require.resolve('@babel/preset-react'), presetReactOptions], require.resolve('@babel/preset-flow')],
|
|
47
|
-
plugins: [...((config === null || config === void 0 ? void 0 : config.plugins) || []), require.resolve('babel-plugin-add-react-displayname')]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export async function webpackFinal(config, options) {
|
|
51
|
-
var isDevelopment = options.configType === 'DEVELOPMENT';
|
|
52
|
-
var reactOptions = await options.presets.apply('reactOptions', {}, options);
|
|
53
|
-
var fastRefreshEnabled = isDevelopment && (reactOptions.fastRefresh || process.env.FAST_REFRESH === 'true');
|
|
54
|
-
|
|
55
|
-
if (!fastRefreshEnabled) {
|
|
56
|
-
return config;
|
|
57
|
-
} // matches the name of the plugin in CRA.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var hasReactRefresh = config.plugins.find(function (p) {
|
|
61
|
-
return p.constructor.name === 'ReactRefreshPlugin';
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (hasReactRefresh) {
|
|
65
|
-
logger.warn("=> React refresh is already set. You don't need to set the option");
|
|
66
|
-
return config;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
logger.info('=> Using React fast refresh');
|
|
70
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
71
|
-
plugins: [...config.plugins, // Storybook uses webpack-hot-middleware https://github.com/storybookjs/storybook/issues/14114
|
|
72
|
-
new ReactRefreshWebpackPlugin({
|
|
73
|
-
overlay: {
|
|
74
|
-
sockIntegration: 'whm'
|
|
75
|
-
}
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
}
|
package/dist/esm/server/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { findDistEsm } from '@storybook/core-common';
|
|
2
|
-
export var previewAnnotations = function (entries = []) {
|
|
3
|
-
return [...entries, findDistEsm(__dirname, 'client/preview/config')];
|
|
4
|
-
};
|
|
5
|
-
export var addons = [require.resolve('./framework-preset-react'), require.resolve('./framework-preset-react-dom-hack'), require.resolve('./framework-preset-cra'), require.resolve('./framework-preset-react-docs')];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const styles = {
|
|
3
|
-
border: '1px solid #eee',
|
|
4
|
-
borderRadius: 3,
|
|
5
|
-
backgroundColor: '#FFFFFF',
|
|
6
|
-
cursor: 'pointer',
|
|
7
|
-
fontSize: 15,
|
|
8
|
-
padding: '3px 10px',
|
|
9
|
-
margin: 10
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const Button = ({
|
|
13
|
-
children,
|
|
14
|
-
onClick
|
|
15
|
-
}) => /*#__PURE__*/React.createElement("button", {
|
|
16
|
-
onClick: onClick,
|
|
17
|
-
style: styles,
|
|
18
|
-
type: "button"
|
|
19
|
-
}, children);
|
|
20
|
-
|
|
21
|
-
Button.displayName = 'Button';
|
|
22
|
-
Button.defaultProps = {
|
|
23
|
-
onClick: () => {}
|
|
24
|
-
};
|
|
25
|
-
export default Button;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
const _excluded = ["children"],
|
|
2
|
-
_excluded2 = ["children", "href", "target", "rel"],
|
|
3
|
-
_excluded3 = ["children", "onClick"];
|
|
4
|
-
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
|
|
11
|
-
const Main = props => /*#__PURE__*/React.createElement("article", _extends({}, props, {
|
|
12
|
-
style: {
|
|
13
|
-
padding: 15,
|
|
14
|
-
lineHeight: 1.4,
|
|
15
|
-
fontFamily: '"Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif',
|
|
16
|
-
backgroundColor: '#fff',
|
|
17
|
-
color: '#000'
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
const Title = _ref => {
|
|
22
|
-
let {
|
|
23
|
-
children
|
|
24
|
-
} = _ref,
|
|
25
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
26
|
-
|
|
27
|
-
return /*#__PURE__*/React.createElement("h1", props, children);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const Note = props => /*#__PURE__*/React.createElement("p", _extends({}, props, {
|
|
31
|
-
style: {
|
|
32
|
-
opacity: 0.5
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
const InlineCode = props => /*#__PURE__*/React.createElement("code", _extends({}, props, {
|
|
37
|
-
style: {
|
|
38
|
-
fontSize: 15,
|
|
39
|
-
fontWeight: 600,
|
|
40
|
-
padding: '2px 5px',
|
|
41
|
-
border: '1px solid #eae9e9',
|
|
42
|
-
borderRadius: 4,
|
|
43
|
-
backgroundColor: '#f3f2f2',
|
|
44
|
-
color: '#3a3a3a'
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
const Link = _ref2 => {
|
|
49
|
-
let {
|
|
50
|
-
children,
|
|
51
|
-
href,
|
|
52
|
-
target,
|
|
53
|
-
rel
|
|
54
|
-
} = _ref2,
|
|
55
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
56
|
-
|
|
57
|
-
return /*#__PURE__*/React.createElement("a", _extends({
|
|
58
|
-
href: href
|
|
59
|
-
}, props, {
|
|
60
|
-
target: target,
|
|
61
|
-
rel: rel,
|
|
62
|
-
style: {
|
|
63
|
-
color: '#1474f3',
|
|
64
|
-
textDecoration: 'none',
|
|
65
|
-
borderBottom: '1px solid #1474f3',
|
|
66
|
-
paddingBottom: 2
|
|
67
|
-
}
|
|
68
|
-
}), children);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const NavButton = _ref3 => {
|
|
72
|
-
let {
|
|
73
|
-
children,
|
|
74
|
-
onClick
|
|
75
|
-
} = _ref3,
|
|
76
|
-
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
77
|
-
|
|
78
|
-
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
79
|
-
type: "button",
|
|
80
|
-
onClick: onClick,
|
|
81
|
-
style: {
|
|
82
|
-
color: '#1474f3',
|
|
83
|
-
textDecoration: 'none',
|
|
84
|
-
borderBottom: '1px solid #1474f3',
|
|
85
|
-
paddingBottom: 2,
|
|
86
|
-
borderTop: 'none',
|
|
87
|
-
borderRight: 'none',
|
|
88
|
-
borderLeft: 'none',
|
|
89
|
-
backgroundColor: 'transparent',
|
|
90
|
-
padding: 0,
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
font: 'inherit'
|
|
93
|
-
}
|
|
94
|
-
}), children);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const Welcome = ({
|
|
98
|
-
showApp
|
|
99
|
-
}) => /*#__PURE__*/React.createElement(Main, null, /*#__PURE__*/React.createElement(Title, null, "Welcome to storybook"), /*#__PURE__*/React.createElement("p", null, "This is a UI component dev environment for your app."), /*#__PURE__*/React.createElement("p", null, "We've added some basic stories inside the ", /*#__PURE__*/React.createElement(InlineCode, null, "src/stories"), " directory.", /*#__PURE__*/React.createElement("br", null), "A story is a single state of one or more UI components. You can have as many stories as you want.", /*#__PURE__*/React.createElement("br", null), "(Basically a story is like a visual test case.)"), /*#__PURE__*/React.createElement("p", null, "See these sample ", /*#__PURE__*/React.createElement(NavButton, {
|
|
100
|
-
onClick: showApp
|
|
101
|
-
}, "stories"), " for a component called\xA0", /*#__PURE__*/React.createElement(InlineCode, null, "Button"), "."), /*#__PURE__*/React.createElement("p", null, "Just like that, you can add your own components as stories.", /*#__PURE__*/React.createElement("br", null), "You can also edit those components and see changes right away.", /*#__PURE__*/React.createElement("br", null), "(Try editing the ", /*#__PURE__*/React.createElement(InlineCode, null, "Button"), " stories located at\xA0", /*#__PURE__*/React.createElement(InlineCode, null, "src/stories/1-Button.stories.js"), ".)"), /*#__PURE__*/React.createElement("p", null, "Usually we create stories with smaller UI components in the app.", /*#__PURE__*/React.createElement("br", null), "Have a look at the\xA0", /*#__PURE__*/React.createElement(Link, {
|
|
102
|
-
href: "https://storybook.js.org/basics/writing-stories",
|
|
103
|
-
target: "_blank",
|
|
104
|
-
rel: "noopener noreferrer"
|
|
105
|
-
}, "Writing Stories"), "\xA0section in our documentation."), /*#__PURE__*/React.createElement(Note, null, /*#__PURE__*/React.createElement("b", null, "NOTE:"), /*#__PURE__*/React.createElement("br", null), "Have a look at the ", /*#__PURE__*/React.createElement(InlineCode, null, ".storybook/webpack.config.js"), " to add webpack loaders and plugins you are using in this project."));
|
|
106
|
-
|
|
107
|
-
Welcome.displayName = 'Welcome';
|
|
108
|
-
export { Welcome as default };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import semver from '@storybook/semver';
|
|
4
|
-
import { logger } from '@storybook/node-logger';
|
|
5
|
-
var appDirectory = fs.realpathSync(process.cwd());
|
|
6
|
-
var reactScriptsPath;
|
|
7
|
-
export function getReactScriptsPath({
|
|
8
|
-
noCache: noCache
|
|
9
|
-
} = {}) {
|
|
10
|
-
if (reactScriptsPath && !noCache) return reactScriptsPath;
|
|
11
|
-
var reactScriptsScriptPath = fs.realpathSync(path.join(appDirectory, '/node_modules/.bin/react-scripts'));
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// Note: Since there is no symlink for .bin/react-scripts on Windows
|
|
15
|
-
// we'll parse react-scripts file to find actual package path.
|
|
16
|
-
// This is important if you use fork of CRA.
|
|
17
|
-
var pathIsNotResolved = /node_modules[\\/]\.bin[\\/]react-scripts/i.test(reactScriptsScriptPath);
|
|
18
|
-
|
|
19
|
-
if (pathIsNotResolved) {
|
|
20
|
-
var content = fs.readFileSync(reactScriptsScriptPath, 'utf8');
|
|
21
|
-
var packagePathMatch = content.match(/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i);
|
|
22
|
-
|
|
23
|
-
if (packagePathMatch && packagePathMatch.length > 1) {
|
|
24
|
-
reactScriptsScriptPath = path.join(appDirectory, '/node_modules/.bin/', packagePathMatch[1]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} catch (e) {
|
|
28
|
-
logger.warn(`Error occurred during react-scripts package path resolving: ${e}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
reactScriptsPath = path.join(reactScriptsScriptPath, '../..');
|
|
32
|
-
var scriptsPkgJson = path.join(reactScriptsPath, 'package.json');
|
|
33
|
-
|
|
34
|
-
if (!fs.existsSync(scriptsPkgJson)) {
|
|
35
|
-
reactScriptsPath = 'react-scripts';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return reactScriptsPath;
|
|
39
|
-
}
|
|
40
|
-
export function isReactScriptsInstalled(requiredVersion = '2.0.0') {
|
|
41
|
-
try {
|
|
42
|
-
// eslint-disable-next-line import/no-dynamic-require,global-require
|
|
43
|
-
var reactScriptsJson = require(path.join(getReactScriptsPath(), 'package.json'));
|
|
44
|
-
|
|
45
|
-
return !semver.gtr(requiredVersion, reactScriptsJson.version);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { logger } from '@storybook/node-logger';
|
|
2
|
-
import { isReactScriptsInstalled } from './cra-config';
|
|
3
|
-
|
|
4
|
-
var checkForNewPreset = function (presetsList) {
|
|
5
|
-
var hasNewPreset = presetsList.some(function (preset) {
|
|
6
|
-
var presetName = typeof preset === 'string' ? preset : preset.name;
|
|
7
|
-
return /@storybook(\/|\\)preset-create-react-app/.test(presetName);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
if (!hasNewPreset) {
|
|
11
|
-
logger.warn('Storybook support for Create React App is now a separate preset.');
|
|
12
|
-
logger.warn('To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file.');
|
|
13
|
-
logger.warn('The built-in preset has been disabled in Storybook 6.0.');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function webpackFinal(config, {
|
|
18
|
-
presetsList: presetsList
|
|
19
|
-
}) {
|
|
20
|
-
if (isReactScriptsInstalled()) {
|
|
21
|
-
checkForNewPreset(presetsList);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return config;
|
|
25
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import "core-js/modules/es.promise.js";
|
|
8
|
-
import { findDistEsm } from '@storybook/core-common';
|
|
9
|
-
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
|
|
10
|
-
import { hasDocsOrControls } from '@storybook/docs-tools';
|
|
11
|
-
export async function babel(config, options) {
|
|
12
|
-
if (!hasDocsOrControls(options)) return config;
|
|
13
|
-
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
14
|
-
var reactDocgen = typescriptOptions.reactDocgen;
|
|
15
|
-
|
|
16
|
-
if (typeof reactDocgen !== 'string') {
|
|
17
|
-
return config;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
21
|
-
overrides: [...((config === null || config === void 0 ? void 0 : config.overrides) || []), {
|
|
22
|
-
test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/,
|
|
23
|
-
plugins: [[require.resolve('babel-plugin-react-docgen'), {
|
|
24
|
-
DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
|
|
25
|
-
}]]
|
|
26
|
-
}]
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export async function webpackFinal(config, options) {
|
|
30
|
-
if (!hasDocsOrControls(options)) return config;
|
|
31
|
-
var typescriptOptions = await options.presets.apply('typescript', {});
|
|
32
|
-
var reactDocgen = typescriptOptions.reactDocgen,
|
|
33
|
-
reactDocgenTypescriptOptions = typescriptOptions.reactDocgenTypescriptOptions;
|
|
34
|
-
|
|
35
|
-
if (reactDocgen !== 'react-docgen-typescript') {
|
|
36
|
-
return config;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
40
|
-
plugins: [...config.plugins, new ReactDocgenTypescriptPlugin(_objectSpread(_objectSpread({}, reactDocgenTypescriptOptions), {}, {
|
|
41
|
-
// We *need* this set so that RDT returns default values in the same format as react-docgen
|
|
42
|
-
savePropValueAsString: true
|
|
43
|
-
}))]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
export var previewAnnotations = function (entry = [], options) {
|
|
47
|
-
if (!hasDocsOrControls(options)) return entry;
|
|
48
|
-
return [...entry, findDistEsm(__dirname, 'client/docs/config')];
|
|
49
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import "core-js/modules/es.promise.js";
|
|
8
|
-
import { readJSON } from 'fs-extra';
|
|
9
|
-
import { IgnorePlugin } from 'webpack'; // this is a hack to allow importing react-dom/client even when it's not available
|
|
10
|
-
// this should be removed once we drop support for react-dom < 18
|
|
11
|
-
|
|
12
|
-
export async function webpackFinal(config) {
|
|
13
|
-
var reactDomPkg = await readJSON(require.resolve('react-dom/package.json'));
|
|
14
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
15
|
-
plugins: [...config.plugins, reactDomPkg.version.startsWith('18') || reactDomPkg.version.startsWith('0.0.0') ? null : new IgnorePlugin({
|
|
16
|
-
resourceRegExp: /react-dom\/client$/,
|
|
17
|
-
contextRegExp: /(app\/react|app\\react|@storybook\/react|@storybook\\react)/ // TODO this needs to work for both in our MONOREPO and in the user's NODE_MODULES
|
|
18
|
-
|
|
19
|
-
})].filter(Boolean)
|
|
20
|
-
});
|
|
21
|
-
}
|