@storybook/preset-create-react-app 3.1.5 → 3.2.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/CHANGELOG.md +12 -0
- package/dist/helpers/checkPresets.d.ts +2 -2
- package/dist/helpers/checkPresets.js +2 -1
- package/dist/helpers/checkPresets.js.map +1 -1
- package/dist/helpers/getModulePath.js +3 -2
- package/dist/helpers/getModulePath.js.map +1 -1
- package/dist/helpers/getReactScriptsPath.d.ts +0 -1
- package/dist/helpers/getReactScriptsPath.js +4 -24
- package/dist/helpers/getReactScriptsPath.js.map +1 -1
- package/dist/helpers/mergePlugins.js +21 -5
- package/dist/helpers/mergePlugins.js.map +1 -1
- package/dist/helpers/processCraConfig.d.ts +2 -2
- package/dist/helpers/processCraConfig.js +19 -13
- package/dist/helpers/processCraConfig.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +33 -25
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 3.2.0
|
|
2
|
+
|
|
3
|
+
- Add disableWebpackDefaults for forward-compatibility with SB core
|
|
4
|
+
|
|
5
|
+
## 3.1.7
|
|
6
|
+
|
|
7
|
+
- CRA: Fix fast refresh config [#193](https://github.com/storybookjs/presets/pull/193)
|
|
8
|
+
|
|
9
|
+
## 3.1.6
|
|
10
|
+
|
|
11
|
+
- Fix monorepos and PnP [#181](https://github.com/storybookjs/presets/pull/181)
|
|
12
|
+
|
|
1
13
|
## 3.1.5
|
|
2
14
|
|
|
3
15
|
- Fix duplicate ReactDocgenTypescriptPlugin [#173](https://github.com/storybookjs/presets/pull/173)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const checkPresets: (options:
|
|
1
|
+
import { PluginOptions } from '../types';
|
|
2
|
+
export declare const checkPresets: (options: PluginOptions) => void;
|
|
@@ -7,7 +7,7 @@ var incompatiblePresets = [
|
|
|
7
7
|
'@storybook/preset-scss',
|
|
8
8
|
'@storybook/preset-typescript',
|
|
9
9
|
];
|
|
10
|
-
|
|
10
|
+
var checkPresets = function (options) {
|
|
11
11
|
var presetsList = options.presetsList || [];
|
|
12
12
|
// Look for a legacy presets file if one exists.
|
|
13
13
|
if (!options.presetsList) {
|
|
@@ -27,4 +27,5 @@ exports.checkPresets = function (options) {
|
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
+
exports.checkPresets = checkPresets;
|
|
30
31
|
//# sourceMappingURL=checkPresets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPresets.js","sourceRoot":"","sources":["../../src/helpers/checkPresets.ts"],"names":[],"mappings":";;;AAAA,6BAAqC;AACrC,sDAAgD;AAGhD,IAAM,mBAAmB,GAAG;IAC1B,wBAAwB;IACxB,8BAA8B;CAC/B,CAAC;
|
|
1
|
+
{"version":3,"file":"checkPresets.js","sourceRoot":"","sources":["../../src/helpers/checkPresets.ts"],"names":[],"mappings":";;;AAAA,6BAAqC;AACrC,sDAAgD;AAGhD,IAAM,mBAAmB,GAAG;IAC1B,wBAAwB;IACxB,8BAA8B;CAC/B,CAAC;AAEK,IAAM,YAAY,GAAG,UAAC,OAAsB;IACjD,IAAI,WAAW,GAAa,OAAO,CAAC,WAAW,IAAK,EAAe,CAAC;IAEpE,gDAAgD;IAChD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;QACxB,IAAI;YACF,IAAM,SAAS,GAAG,cAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC7C,yGAAyG;YACzG,WAAW,GAAG,OAAO,CAAW,WAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;SAChE;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;SACR;KACF;IAED,WAAW,CAAC,OAAO,CAAC,UAAC,MAAiC;QACpD,IAAM,UAAU,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QACrE,IAAI,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAC5C,oBAAM,CAAC,IAAI,CACT,MAAK,UAAU,sEAAsE,CACtF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAtBW,QAAA,YAAY,gBAsBvB"}
|
|
@@ -5,7 +5,7 @@ var fs_1 = require("fs");
|
|
|
5
5
|
var path_1 = require("path");
|
|
6
6
|
var JSCONFIG = 'jsconfig.json';
|
|
7
7
|
var TSCONFIG = 'tsconfig.json';
|
|
8
|
-
|
|
8
|
+
var getModulePath = function (appDirectory) {
|
|
9
9
|
// CRA only supports `jsconfig.json` if `tsconfig.json` doesn't exist.
|
|
10
10
|
var configName = '';
|
|
11
11
|
if (fs_1.existsSync(path_1.join(appDirectory, TSCONFIG))) {
|
|
@@ -17,10 +17,11 @@ exports.getModulePath = function (appDirectory) {
|
|
|
17
17
|
try {
|
|
18
18
|
// eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires
|
|
19
19
|
var baseUrl = require(path_1.join(appDirectory, configName)).compilerOptions.baseUrl;
|
|
20
|
-
return baseUrl ? [baseUrl] : [];
|
|
20
|
+
return (baseUrl ? [baseUrl] : []);
|
|
21
21
|
}
|
|
22
22
|
catch (e) {
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
+
exports.getModulePath = getModulePath;
|
|
26
27
|
//# sourceMappingURL=getModulePath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModulePath.js","sourceRoot":"","sources":["../../src/helpers/getModulePath.ts"],"names":[],"mappings":";;;AAAA,yBAAgC;AAChC,6BAA4B;
|
|
1
|
+
{"version":3,"file":"getModulePath.js","sourceRoot":"","sources":["../../src/helpers/getModulePath.ts"],"names":[],"mappings":";;;AAAA,yBAAgC;AAChC,6BAA4B;AAQ5B,IAAM,QAAQ,GAAG,eAAe,CAAC;AACjC,IAAM,QAAQ,GAAG,eAAe,CAAC;AAE1B,IAAM,aAAa,GAAG,UAAC,YAAoB;IAChD,sEAAsE;IACtE,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,eAAU,CAAC,WAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,EAAE;QAC5C,UAAU,GAAG,QAAQ,CAAC;KACvB;SAAM,IAAI,eAAU,CAAC,WAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,EAAE;QACnD,UAAU,GAAG,QAAQ,CAAC;KACvB;IAED,IAAI;QACF,yGAAyG;QACjG,IAAA,OAAO,GAAK,OAAO,CAAkB,WAAI,CAC/C,YAAY,EACZ,UAAU,CACX,CAAC,CAAC,eAAe,QAHH,CAGI;QACnB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAa,CAAC;KAC/C;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC;AAnBW,QAAA,aAAa,iBAmBxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getReactScriptsPath = void 0;
|
|
4
4
|
var fs_1 = require("fs");
|
|
5
5
|
var path_1 = require("path");
|
|
6
|
-
|
|
6
|
+
var getReactScriptsPath = function () {
|
|
7
7
|
var cwd = process.cwd();
|
|
8
8
|
var scriptsBinPath = path_1.join(cwd, '/node_modules/.bin/react-scripts');
|
|
9
9
|
if (process.platform === 'win32') {
|
|
@@ -42,7 +42,7 @@ exports.getReactScriptsPath = function () {
|
|
|
42
42
|
* Try to find the `react-scripts` package by name (won't catch forked scripts packages).
|
|
43
43
|
*/
|
|
44
44
|
try {
|
|
45
|
-
var scriptsPath = require.resolve('react-scripts');
|
|
45
|
+
var scriptsPath = path_1.dirname(require.resolve('react-scripts/package.json'));
|
|
46
46
|
return scriptsPath;
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
@@ -50,25 +50,5 @@ exports.getReactScriptsPath = function () {
|
|
|
50
50
|
}
|
|
51
51
|
return '';
|
|
52
52
|
};
|
|
53
|
-
exports.
|
|
54
|
-
if (packageName === void 0) { packageName = 'react-scripts'; }
|
|
55
|
-
/*
|
|
56
|
-
* Use Plug'n'Play API to introspect the dependency tree at runtime.
|
|
57
|
-
* See https://yarnpkg.com/advanced/pnpapi for more.
|
|
58
|
-
*/
|
|
59
|
-
// eslint-disable-next-line import/no-unresolved, @typescript-eslint/no-var-requires, global-require
|
|
60
|
-
var pnpApi = require('pnpapi');
|
|
61
|
-
// Get list of all dependencies of the project
|
|
62
|
-
var packageDependencies = pnpApi.getPackageInformation({
|
|
63
|
-
name: null,
|
|
64
|
-
reference: null,
|
|
65
|
-
}).packageDependencies;
|
|
66
|
-
/*
|
|
67
|
-
* Get location of the package named `packageName`, this package must be
|
|
68
|
-
* listed as dependency to be able to find it's location (and no more just
|
|
69
|
-
* be present in node_modules folder)
|
|
70
|
-
*/
|
|
71
|
-
var packageLocation = pnpApi.getPackageInformation(pnpApi.getLocator(packageName, packageDependencies.get(packageName))).packageLocation;
|
|
72
|
-
return packageLocation;
|
|
73
|
-
};
|
|
53
|
+
exports.getReactScriptsPath = getReactScriptsPath;
|
|
74
54
|
//# sourceMappingURL=getReactScriptsPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReactScriptsPath.js","sourceRoot":"","sources":["../../src/helpers/getReactScriptsPath.ts"],"names":[],"mappings":";;;AAAA,yBAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"getReactScriptsPath.js","sourceRoot":"","sources":["../../src/helpers/getReactScriptsPath.ts"],"names":[],"mappings":";;;AAAA,yBAAgD;AAChD,6BAAqC;AAE9B,I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var
|
|
20
|
-
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
19
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
20
|
+
to[j] = from[i];
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
25
|
};
|
|
22
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
27
|
exports.mergePlugins = void 0;
|
|
24
|
-
|
|
28
|
+
var react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
29
|
+
var mergePlugins = function () {
|
|
25
30
|
var args = [];
|
|
26
31
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
27
32
|
args[_i] = arguments[_i];
|
|
@@ -32,7 +37,18 @@ exports.mergePlugins = function () {
|
|
|
32
37
|
})) {
|
|
33
38
|
return plugins;
|
|
34
39
|
}
|
|
35
|
-
|
|
40
|
+
var updatedPlugin = plugin;
|
|
41
|
+
if (plugin.constructor.name === 'ReactRefreshPlugin') {
|
|
42
|
+
// Storybook uses webpack-hot-middleware
|
|
43
|
+
// https://github.com/storybookjs/presets/issues/177
|
|
44
|
+
updatedPlugin = new react_refresh_webpack_plugin_1.default({
|
|
45
|
+
overlay: {
|
|
46
|
+
sockIntegration: 'whm',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return __spreadArray(__spreadArray([], __read(plugins)), [updatedPlugin]);
|
|
36
51
|
}, []);
|
|
37
52
|
};
|
|
53
|
+
exports.mergePlugins = mergePlugins;
|
|
38
54
|
//# sourceMappingURL=mergePlugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergePlugins.js","sourceRoot":"","sources":["../../src/helpers/mergePlugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergePlugins.js","sourceRoot":"","sources":["../../src/helpers/mergePlugins.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sGAA6E;AAEtE,IAAM,YAAY,GAAG;IAAC,cAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,yBAAiB;;IAC5C,OAAA,IAAI,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,MAAM;QAC1B,IACE,OAAO,CAAC,IAAI,CACV,UAAC,cAAc;YACb,OAAA,cAAc,CAAC,WAAW,CAAC,IAAI,KAAK,MAAM,CAAC,WAAW,CAAC,IAAI;QAA3D,CAA2D,CAC9D,EACD;YACA,OAAO,OAAO,CAAC;SAChB;QACD,IAAI,aAAa,GAAG,MAAM,CAAC;QAC3B,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,oBAAoB,EAAE;YACpD,wCAAwC;YACxC,oDAAoD;YAEpD,aAAa,GAAG,IAAI,sCAAyB,CAAC;gBAC5C,OAAO,EAAE;oBACP,eAAe,EAAE,KAAK;iBACvB;aACF,CAAC,CAAC;SACJ;QACD,8CAAW,OAAO,KAAE,aAAa,GAAE;IACrC,CAAC,EAAE,EAAc,CAAC;AArBlB,CAqBkB,CAAC;AAtBR,QAAA,YAAY,gBAsBJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Configuration, RuleSetRule } from 'webpack';
|
|
2
|
-
import {
|
|
3
|
-
export declare const processCraConfig: (craWebpackConfig: Configuration, options:
|
|
2
|
+
import { PluginOptions } from '../types';
|
|
3
|
+
export declare const processCraConfig: (craWebpackConfig: Configuration, options: PluginOptions) => RuleSetRule[];
|
|
@@ -26,9 +26,10 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
26
26
|
}
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
|
-
var
|
|
30
|
-
for (var
|
|
31
|
-
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
30
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
31
|
+
to[j] = from[i];
|
|
32
|
+
return to;
|
|
32
33
|
};
|
|
33
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -51,7 +52,7 @@ var testMatch = function (rule, string) {
|
|
|
51
52
|
? rule.test.some(function (test) { return isRegExp(test) && test.test(string); })
|
|
52
53
|
: isRegExp(rule.test) && rule.test.test(string);
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
var processCraConfig = function (craWebpackConfig, options) {
|
|
55
56
|
var configDir = path_1.resolve(options.configDir);
|
|
56
57
|
/*
|
|
57
58
|
* NOTE: As of version 5.3.0 of Storybook, Storybook's default loaders are no
|
|
@@ -71,7 +72,7 @@ exports.processCraConfig = function (craWebpackConfig, options) {
|
|
|
71
72
|
// Add our `configDir` to support JSX and TypeScript in that folder.
|
|
72
73
|
if (testMatch(rule, '.jsx')) {
|
|
73
74
|
var newRule = __assign(__assign({}, rule), { include: [include, configDir] });
|
|
74
|
-
return
|
|
75
|
+
return __spreadArray(__spreadArray([], __read(rules)), [newRule]);
|
|
75
76
|
}
|
|
76
77
|
/*
|
|
77
78
|
* CRA makes use of Webpack's `oneOf` feature.
|
|
@@ -80,20 +81,24 @@ exports.processCraConfig = function (craWebpackConfig, options) {
|
|
|
80
81
|
* Here, we map over those rules and add our `configDir` as above.
|
|
81
82
|
*/
|
|
82
83
|
if (oneOf) {
|
|
83
|
-
return
|
|
84
|
+
return __spreadArray(__spreadArray([], __read(rules)), [
|
|
84
85
|
{
|
|
85
86
|
oneOf: oneOf.map(function (oneOfRule) {
|
|
86
87
|
var _a, _b;
|
|
87
88
|
if (isString(oneOfRule.loader) &&
|
|
88
89
|
/[/\\]file-loader[/\\]/.test(oneOfRule.loader)) {
|
|
89
90
|
if (isStorybook530) {
|
|
90
|
-
var excludes =
|
|
91
|
+
var excludes = __spreadArray([
|
|
91
92
|
'ejs',
|
|
92
93
|
'md',
|
|
93
94
|
'mdx'
|
|
94
|
-
], (((_a = options.craOverrides) === null || _a === void 0 ? void 0 : _a.fileLoaderExcludes) || []));
|
|
95
|
+
], __read((((_a = options.craOverrides) === null || _a === void 0 ? void 0 : _a.fileLoaderExcludes) || [])));
|
|
95
96
|
var excludeRegex = new RegExp("\\.(" + excludes.join('|') + ")$");
|
|
96
|
-
return __assign(__assign({}, oneOfRule), {
|
|
97
|
+
return __assign(__assign({}, oneOfRule), {
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
exclude: __spreadArray(__spreadArray([], __read(oneOfRule.exclude)), [
|
|
100
|
+
excludeRegex,
|
|
101
|
+
]) });
|
|
97
102
|
}
|
|
98
103
|
return {};
|
|
99
104
|
}
|
|
@@ -109,9 +114,9 @@ exports.processCraConfig = function (craWebpackConfig, options) {
|
|
|
109
114
|
isRegExp(oneOfRule.test) &&
|
|
110
115
|
oneOfRule.test.test('.jsx')) {
|
|
111
116
|
var _include = oneOfRule.include, ruleOptions = oneOfRule.options;
|
|
112
|
-
var _c = typeof ruleOptions === 'object' ? ruleOptions : {},
|
|
113
|
-
var
|
|
114
|
-
return __assign(__assign({}, oneOfRule), { include: [_include, configDir], options: __assign(__assign({}, ruleOptions), { extends: _extends, plugins:
|
|
117
|
+
var _c = (typeof ruleOptions === 'object' ? ruleOptions : {}), rulePlugins = _c.plugins, rulePresets = _c.presets;
|
|
118
|
+
var _d = options.babelOptions, _extends = _d.extends, plugins = _d.plugins, presets = _d.presets;
|
|
119
|
+
return __assign(__assign({}, oneOfRule), { include: [_include, configDir], options: __assign(__assign({}, ruleOptions), { extends: _extends, plugins: __spreadArray(__spreadArray([], __read((plugins !== null && plugins !== void 0 ? plugins : []))), __read((rulePlugins !== null && rulePlugins !== void 0 ? rulePlugins : []))), presets: __spreadArray(__spreadArray([], __read((presets !== null && presets !== void 0 ? presets : []))), __read((rulePresets !== null && rulePresets !== void 0 ? rulePresets : []))),
|
|
115
120
|
// A temporary fix to align with Storybook 6.
|
|
116
121
|
overrides: [
|
|
117
122
|
{
|
|
@@ -141,7 +146,8 @@ exports.processCraConfig = function (craWebpackConfig, options) {
|
|
|
141
146
|
},
|
|
142
147
|
]);
|
|
143
148
|
}
|
|
144
|
-
return
|
|
149
|
+
return __spreadArray(__spreadArray([], __read(rules)), [rule]);
|
|
145
150
|
}, []);
|
|
146
151
|
};
|
|
152
|
+
exports.processCraConfig = processCraConfig;
|
|
147
153
|
//# sourceMappingURL=processCraConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processCraConfig.js","sourceRoot":"","sources":["../../src/helpers/processCraConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processCraConfig.js","sourceRoot":"","sources":["../../src/helpers/processCraConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA+B;AAE/B,kDAA4B;AAI5B,IAAM,QAAQ,GAAG,UAAC,KAAuB;IACvC,OAAA,KAAK,YAAY,MAAM;AAAvB,CAAuB,CAAC;AAE1B,IAAM,QAAQ,GAAG,UAAC,KAAuB;IACvC,OAAA,OAAO,KAAK,KAAK,QAAQ;AAAzB,CAAyB,CAAC;AAE5B,6CAA6C;AAC7C,IAAM,SAAS,GAAG,UAAC,IAAiB,EAAE,MAAc;IAClD,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC;QAC/D,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC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AAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAAE,CAAC,IACpD,OAAO,yCAAM,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,WAAK,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAAE,CAAC;oCACpD,6CAA6C;oCAC7C,SAAS,EAAE;wCACT;4CACE,IAAI,EACF,CAAA,MAAA,OAAO,CAAC,iBAAiB,0CAAE,WAAW;gDACtC,cAAc;gDACZ,CAAC,CAAC,oBAAoB;gDACtB,CAAC,CAAC,eAAe;4CACrB,OAAO,EAAE;gDACP;oDACE,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC;oDAC5C;wDACE,uBAAuB,EAAE,yBAAyB;qDACnD;iDACF;6CACF;yCACF;qCACF,OAEH;yBACH;wBAED,qFAAqF;wBACrF,IACE,aAAa;4BACb,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;4BACxB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAC1B;4BACA,6BACK,SAAS,KACZ,OAAO,EAAE,CAAC,SAAS,CAAC,IACpB;yBACH;wBAED,OAAO,SAAS,CAAC;oBACnB,CAAC,CAAC;iBACH;eACD;SACH;QAED,8CAAW,KAAK,KAAE,IAAI,GAAE;IAC1B,CAAC,EAAE,EAAmB,CAAC,CAAC;AAC1B,CAAC,CAAC;AAxJW,QAAA,gBAAgB,oBAwJ3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { PluginOptions } from './types';
|
|
3
|
+
export declare const core: () => {
|
|
4
|
+
disableWebpackDefaults: boolean;
|
|
5
|
+
};
|
|
3
6
|
export declare const babelDefault: () => Record<string, (string | [string, object])[]>;
|
|
4
7
|
export declare const managerWebpack: (webpackConfig?: Configuration) => Configuration;
|
|
5
|
-
export declare const webpack: (webpackConfig: Configuration | undefined, options:
|
|
8
|
+
export declare const webpack: (webpackConfig: Configuration | undefined, options: PluginOptions) => Configuration;
|
package/dist/index.js
CHANGED
|
@@ -26,15 +26,16 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
26
26
|
}
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
|
-
var
|
|
30
|
-
for (var
|
|
31
|
-
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
30
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
31
|
+
to[j] = from[i];
|
|
32
|
+
return to;
|
|
32
33
|
};
|
|
33
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
36
|
};
|
|
36
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.webpack = exports.managerWebpack = exports.babelDefault = void 0;
|
|
38
|
+
exports.webpack = exports.managerWebpack = exports.babelDefault = exports.core = void 0;
|
|
38
39
|
var path_1 = require("path");
|
|
39
40
|
var semver_1 = __importDefault(require("semver"));
|
|
40
41
|
var node_logger_1 = require("@storybook/node-logger");
|
|
@@ -46,12 +47,7 @@ var processCraConfig_1 = require("./helpers/processCraConfig");
|
|
|
46
47
|
var checkPresets_1 = require("./helpers/checkPresets");
|
|
47
48
|
var getModulePath_1 = require("./helpers/getModulePath");
|
|
48
49
|
var CWD = process.cwd();
|
|
49
|
-
|
|
50
|
-
// indicating the version of the PnP standard, see: https://yarnpkg.com/advanced/pnpapi#processversionspnp
|
|
51
|
-
var IS_USING_YARN_PNP = typeof process.versions.pnp !== 'undefined';
|
|
52
|
-
var REACT_SCRIPTS_PATH = IS_USING_YARN_PNP
|
|
53
|
-
? getReactScriptsPath_1.getReactScriptsPathWithYarnPnp()
|
|
54
|
-
: getReactScriptsPath_1.getReactScriptsPath();
|
|
50
|
+
var REACT_SCRIPTS_PATH = getReactScriptsPath_1.getReactScriptsPath();
|
|
55
51
|
var OPTION_SCRIPTS_PACKAGE = 'scriptsPackageName';
|
|
56
52
|
// Ensures that assets are served from the correct path when Storybook is built.
|
|
57
53
|
// Resolves: https://github.com/storybookjs/storybook/issues/4645
|
|
@@ -63,18 +59,26 @@ var resolveLoader = {
|
|
|
63
59
|
modules: ['node_modules', path_1.join(REACT_SCRIPTS_PATH, 'node_modules')],
|
|
64
60
|
plugins: [pnp_webpack_plugin_1.default.moduleLoader(module)],
|
|
65
61
|
};
|
|
62
|
+
// TODO: Replace with exported type from Storybook.
|
|
63
|
+
var core = function () { return ({
|
|
64
|
+
disableWebpackDefaults: true,
|
|
65
|
+
}); };
|
|
66
|
+
exports.core = core;
|
|
66
67
|
// Don't use Storybook's default Babel config.
|
|
67
|
-
|
|
68
|
+
var babelDefault = function () { return ({
|
|
68
69
|
presets: [],
|
|
69
70
|
plugins: [],
|
|
70
71
|
}); };
|
|
72
|
+
exports.babelDefault = babelDefault;
|
|
71
73
|
// Ensure that loaders are resolved from react-scripts.
|
|
72
|
-
|
|
74
|
+
var managerWebpack = function (webpackConfig) {
|
|
73
75
|
if (webpackConfig === void 0) { webpackConfig = {}; }
|
|
74
76
|
return (__assign(__assign({}, webpackConfig), { resolveLoader: resolveLoader }));
|
|
75
77
|
};
|
|
78
|
+
exports.managerWebpack = managerWebpack;
|
|
76
79
|
// Update the core Webpack config.
|
|
77
|
-
|
|
80
|
+
var webpack = function (webpackConfig, options) {
|
|
81
|
+
var _a, _b, _c, _d, _e;
|
|
78
82
|
if (webpackConfig === void 0) { webpackConfig = {}; }
|
|
79
83
|
var scriptsPath = REACT_SCRIPTS_PATH;
|
|
80
84
|
// Flag any potentially conflicting presets.
|
|
@@ -83,9 +87,9 @@ exports.webpack = function (webpackConfig, options) {
|
|
|
83
87
|
var scriptsPackageName = options[OPTION_SCRIPTS_PACKAGE];
|
|
84
88
|
if (typeof scriptsPackageName === 'string') {
|
|
85
89
|
try {
|
|
86
|
-
scriptsPath =
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
scriptsPath = path_1.dirname(require.resolve(scriptsPackageName + "/package.json", {
|
|
91
|
+
paths: [options.configDir],
|
|
92
|
+
}));
|
|
89
93
|
}
|
|
90
94
|
catch (e) {
|
|
91
95
|
node_logger_1.logger.warn("A `" + OPTION_SCRIPTS_PACKAGE + "` was provided, but couldn't be resolved.");
|
|
@@ -107,35 +111,39 @@ exports.webpack = function (webpackConfig, options) {
|
|
|
107
111
|
});
|
|
108
112
|
// Require the CRA config and set the appropriate mode.
|
|
109
113
|
var craWebpackConfigPath = path_1.join(scriptsPath, 'config', 'webpack.config');
|
|
110
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires
|
|
114
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call
|
|
111
115
|
var craWebpackConfig = require(craWebpackConfigPath)(webpackConfig.mode);
|
|
112
116
|
// Select the relevent CRA rules and add the Storybook config directory.
|
|
113
117
|
node_logger_1.logger.info("=> Modifying Create React App rules.");
|
|
114
118
|
var craRules = processCraConfig_1.processCraConfig(craWebpackConfig, options);
|
|
115
119
|
// CRA uses the `ModuleScopePlugin` to limit suppot to the `src` directory.
|
|
116
120
|
// Here, we select the plugin and modify its configuration to include Storybook config directory.
|
|
117
|
-
var plugins = craWebpackConfig.resolve.plugins.map(function (plugin) {
|
|
118
|
-
if (plugin
|
|
121
|
+
var plugins = (_c = (_b = (_a = craWebpackConfig.resolve) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.map(function (plugin) {
|
|
122
|
+
if ('appSrcs' in plugin) {
|
|
119
123
|
// Mutate the plugin directly as opposed to recreating it.
|
|
120
124
|
// eslint-disable-next-line no-param-reassign
|
|
121
|
-
plugin.appSrcs =
|
|
125
|
+
plugin.appSrcs = __spreadArray(__spreadArray([], __read(plugin.appSrcs)), [path_1.resolve(options.configDir)]);
|
|
122
126
|
}
|
|
123
127
|
return plugin;
|
|
124
|
-
});
|
|
128
|
+
})) !== null && _c !== void 0 ? _c : [];
|
|
125
129
|
// NOTE: These are set by default in Storybook 6.
|
|
126
130
|
var isStorybook6 = semver_1.default.gte(options.packageJson.version || '', '6.0.0');
|
|
127
|
-
var
|
|
131
|
+
var _f = options.typescriptOptions, typescriptOptions = _f === void 0 ? {
|
|
128
132
|
reactDocgen: 'react-docgen-typescript',
|
|
129
133
|
reactDocgenTypescriptOptions: {},
|
|
130
|
-
} :
|
|
134
|
+
} : _f;
|
|
131
135
|
var tsDocgenPlugin = !isStorybook6 && typescriptOptions.reactDocgen === 'react-docgen-typescript'
|
|
132
136
|
? [
|
|
133
137
|
new react_docgen_typescript_plugin_1.default(typescriptOptions.reactDocgenTypescriptOptions),
|
|
134
138
|
]
|
|
135
139
|
: [];
|
|
136
140
|
// Return the new config.
|
|
137
|
-
return __assign(__assign({}, webpackConfig), { module: __assign(__assign({}, webpackConfig.module), { rules:
|
|
141
|
+
return __assign(__assign({}, webpackConfig), { module: __assign(__assign({}, webpackConfig.module), { rules: __spreadArray(__spreadArray([], __read((filteredRules || []))), __read(craRules)) }),
|
|
142
|
+
// NOTE: this prioritizes the storybook version of a plugin
|
|
143
|
+
// when there are duplicates between SB and CRA
|
|
144
|
+
plugins: mergePlugins_1.mergePlugins.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], __read((webpackConfig.plugins || []))), __read(((_d = craWebpackConfig.plugins) !== null && _d !== void 0 ? _d : []))), __read(tsDocgenPlugin))), resolve: __assign(__assign({}, webpackConfig.resolve), { extensions: (_e = craWebpackConfig.resolve) === null || _e === void 0 ? void 0 : _e.extensions, modules: __spreadArray(__spreadArray(__spreadArray([], __read(((webpackConfig.resolve && webpackConfig.resolve.modules) || []))), [
|
|
138
145
|
path_1.join(REACT_SCRIPTS_PATH, 'node_modules')
|
|
139
|
-
], getModulePath_1.getModulePath(CWD)), plugins:
|
|
146
|
+
]), __read(getModulePath_1.getModulePath(CWD))), plugins: __spreadArray(__spreadArray([], __read(plugins)), [pnp_webpack_plugin_1.default]) }), resolveLoader: resolveLoader });
|
|
140
147
|
};
|
|
148
|
+
exports.webpack = webpack;
|
|
141
149
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAwD;AAExD,kDAA4B;AAC5B,sDAAgD;AAChD,0EAAkD;AAClD,kGAAyE;AACzE,uDAAsD;AACtD,qEAAoE;AACpE,+DAA8D;AAC9D,uDAAsD;AACtD,yDAAwD;AAGxD,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1B,IAAM,kBAAkB,GAAG,yCAAmB,EAAE,CAAC;AACjD,IAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAEpD,gFAAgF;AAChF,iEAAiE;AACjE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;IAC3B,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;CAC9B;AAED,8EAA8E;AAC9E,IAAM,aAAa,GAAkB;IACnC,OAAO,EAAE,CAAC,cAAc,EAAE,WAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IACnE,OAAO,EAAE,CAAC,4BAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CACjD,CAAC;AAEF,mDAAmD;AAC5C,IAAM,IAAI,GAAG,cAA2C,OAAA,CAAC;IAC9D,sBAAsB,EAAE,IAAI;CAC7B,CAAC,EAF6D,CAE7D,CAAC;AAFU,QAAA,IAAI,QAEd;AAEH,8CAA8C;AACvC,IAAM,YAAY,GAAG,cAIvB,OAAA,CAAC;IACJ,OAAO,EAAE,EAAE;IACX,OAAO,EAA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BAAyB;QAC1E,CAAC,CAAC;YACE,IAAI,wCAA2B,CAC7B,iBAAiB,CAAC,4BAA4B,CAC/C;SACF;QACH,CAAC,CAAC,EAAE,CAAC;IAET,yBAAyB;IACzB,6BACK,aAAa,KAChB,MAAM,wBACD,aAAa,CAAC,MAAM,KACvB,KAAK,yCAAM,CAAC,aAAa,IAAI,EAAE,CAAC,WAAK,QAAQ;QAE/C,2DAA2D;QAC3D,+CAA+C;QAC/C,OAAO,EAAE,2BAAY,oEAChB,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,WAC7B,CAAC,MAAA,gBAAgB,CAAC,OAAO,mCAAI,EAAE,CAAC,WAChC,cAAc,KAEnB,OAAO,wBACF,aAAa,CAAC,OAAO,KACxB,UAAU,EAAE,MAAA,gBAAgB,CAAC,OAAO,0CAAE,UAAU,EAChD,OAAO,uDACF,CAAC,CAAC,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACnE,WAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC;uBACrC,6BAAa,CAAC,GAAG,CAAC,IAEvB,OAAO,EAAE,uCAAI,OAAO,KAAE,4BAAgB,EAAoB,KAE5D,aAAa,eAAA,IACb;AACJ,CAAC,CAAC;AAnHW,QAAA,OAAO,WAmHlB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PluginItem } from '@babel/core';
|
|
2
|
-
import type { PluginOptions } from 'react-docgen-typescript-plugin';
|
|
2
|
+
import type { PluginOptions as RDTSPluginOptions } from 'react-docgen-typescript-plugin';
|
|
3
3
|
export declare type Preset = string | {
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
|
-
export interface
|
|
6
|
+
export interface PluginOptions {
|
|
7
7
|
/**
|
|
8
8
|
* Optionally set the package name of a react-scripts fork.
|
|
9
9
|
* In most cases, the package is located automatically by this preset.
|
|
@@ -27,6 +27,6 @@ export interface StorybookConfig {
|
|
|
27
27
|
};
|
|
28
28
|
typescriptOptions?: {
|
|
29
29
|
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
|
|
30
|
-
reactDocgenTypescriptOptions:
|
|
30
|
+
reactDocgenTypescriptOptions: RDTSPluginOptions;
|
|
31
31
|
};
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/preset-create-react-app",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Create React App preset for Storybook",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist",
|
|
@@ -18,23 +18,24 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "rm -rf dist
|
|
21
|
+
"build": "rm -rf dist && tsc",
|
|
22
22
|
"build-watch": "yarn build -w",
|
|
23
23
|
"build-storybook": "exit 0;",
|
|
24
24
|
"prepublishOnly": "yarn build"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
|
27
28
|
"@types/babel__core": "^7.1.7",
|
|
28
29
|
"@types/webpack": "^4.41.13",
|
|
29
30
|
"babel-plugin-react-docgen": "^4.1.0",
|
|
30
31
|
"pnp-webpack-plugin": "^1.6.4",
|
|
31
|
-
"react-docgen-typescript-plugin": "^0.
|
|
32
|
-
"semver": "^7.3.
|
|
32
|
+
"react-docgen-typescript-plugin": "^1.0.0",
|
|
33
|
+
"semver": "^7.3.5"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@storybook/node-logger": "^
|
|
36
|
-
"@types/semver": "^7.
|
|
37
|
-
"typescript": "^
|
|
36
|
+
"@storybook/node-logger": "^6.3.2",
|
|
37
|
+
"@types/semver": "^7.3.6",
|
|
38
|
+
"typescript": "^4.1.3"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@babel/core": "*",
|