@storybook/core-webpack 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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/cjs/check-webpack-version.js +34 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/load-custom-webpack-config.js +24 -0
- package/dist/cjs/merge-webpack-config.js +119 -0
- package/dist/cjs/types.js +5 -0
- package/dist/esm/check-webpack-version.js +20 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/load-custom-webpack-config.js +4 -0
- package/dist/esm/merge-webpack-config.js +74 -0
- package/dist/esm/types.js +1 -0
- package/dist/types/check-webpack-version.d.ts +3 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/load-custom-webpack-config.d.ts +1 -0
- package/dist/types/merge-webpack-config.d.ts +2 -0
- package/dist/types/types.d.ts +27 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Storybook Core-Common
|
|
2
|
+
|
|
3
|
+
Common utilities used across `@storybook/core-server` (manager UI configuration) and `@storybook/builder-webpack{4,5}` (preview configuration).
|
|
4
|
+
|
|
5
|
+
This is a lot of code extracted for convenience, not because it made sense.
|
|
6
|
+
|
|
7
|
+
Supporting multiple version of webpack and this duplicating a large portion of code that was never meant to be generic caused this.
|
|
8
|
+
|
|
9
|
+
At some point we'll refactor this, it's likely a lot of this code is dead or barely used.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.slice.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.freeze.js");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.checkWebpackVersion = void 0;
|
|
11
|
+
|
|
12
|
+
var _nodeLogger = require("@storybook/node-logger");
|
|
13
|
+
|
|
14
|
+
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
21
|
+
|
|
22
|
+
var checkWebpackVersion = function checkWebpackVersion(webpack, specifier, caption) {
|
|
23
|
+
if (!webpack.version) {
|
|
24
|
+
_nodeLogger.logger.info('Skipping webpack version check, no version available');
|
|
25
|
+
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (webpack.version !== specifier) {
|
|
30
|
+
_nodeLogger.logger.warn((0, _tsDedent.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n Unexpected webpack version in ", ":\n - Received '", "'\n - Expected '", "'\n\n If you're using Webpack 5 in SB6.2 and upgrading, consider: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build\n\n For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting\n "])), caption, webpack.version, specifier));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.checkWebpackVersion = checkWebpackVersion;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.keys.js");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _types = require("./types");
|
|
14
|
+
|
|
15
|
+
Object.keys(_types).forEach(function (key) {
|
|
16
|
+
if (key === "default" || key === "__esModule") return;
|
|
17
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
18
|
+
Object.defineProperty(exports, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _types[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
var _loadCustomWebpackConfig = require("./load-custom-webpack-config");
|
|
27
|
+
|
|
28
|
+
Object.keys(_loadCustomWebpackConfig).forEach(function (key) {
|
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (key in exports && exports[key] === _loadCustomWebpackConfig[key]) return;
|
|
31
|
+
Object.defineProperty(exports, key, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _loadCustomWebpackConfig[key];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
var _checkWebpackVersion = require("./check-webpack-version");
|
|
40
|
+
|
|
41
|
+
Object.keys(_checkWebpackVersion).forEach(function (key) {
|
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
|
43
|
+
if (key in exports && exports[key] === _checkWebpackVersion[key]) return;
|
|
44
|
+
Object.defineProperty(exports, key, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _checkWebpackVersion[key];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var _mergeWebpackConfig = require("./merge-webpack-config");
|
|
53
|
+
|
|
54
|
+
Object.keys(_mergeWebpackConfig).forEach(function (key) {
|
|
55
|
+
if (key === "default" || key === "__esModule") return;
|
|
56
|
+
if (key in exports && exports[key] === _mergeWebpackConfig[key]) return;
|
|
57
|
+
Object.defineProperty(exports, key, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function get() {
|
|
60
|
+
return _mergeWebpackConfig[key];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.loadCustomWebpackConfig = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/es.array.map.js");
|
|
9
|
+
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
|
|
12
|
+
var _coreCommon = require("@storybook/core-common");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var webpackConfigs = ['webpack.config', 'webpackfile'];
|
|
17
|
+
|
|
18
|
+
var loadCustomWebpackConfig = function loadCustomWebpackConfig(configDir) {
|
|
19
|
+
return (0, _coreCommon.serverRequire)(webpackConfigs.map(function (configName) {
|
|
20
|
+
return _path.default.resolve(configDir, configName);
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.loadCustomWebpackConfig = loadCustomWebpackConfig;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.description.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.array.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.string.iterator.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.array.from.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.array.slice.js");
|
|
20
|
+
|
|
21
|
+
require("core-js/modules/es.function.name.js");
|
|
22
|
+
|
|
23
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, "__esModule", {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
28
|
+
exports.mergeConfigs = mergeConfigs;
|
|
29
|
+
|
|
30
|
+
require("core-js/modules/es.array.concat.js");
|
|
31
|
+
|
|
32
|
+
require("core-js/modules/es.object.assign.js");
|
|
33
|
+
|
|
34
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
41
|
+
|
|
42
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function plugins(_ref, _ref2) {
|
|
47
|
+
var _ref$plugins = _ref.plugins,
|
|
48
|
+
defaultPlugins = _ref$plugins === void 0 ? [] : _ref$plugins;
|
|
49
|
+
var _ref2$plugins = _ref2.plugins,
|
|
50
|
+
customPlugins = _ref2$plugins === void 0 ? [] : _ref2$plugins;
|
|
51
|
+
return [].concat(_toConsumableArray(defaultPlugins), _toConsumableArray(customPlugins));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function rules(_ref3, _ref4) {
|
|
55
|
+
var _ref3$rules = _ref3.rules,
|
|
56
|
+
defaultRules = _ref3$rules === void 0 ? [] : _ref3$rules;
|
|
57
|
+
var _ref4$rules = _ref4.rules,
|
|
58
|
+
customRules = _ref4$rules === void 0 ? [] : _ref4$rules;
|
|
59
|
+
return [].concat(_toConsumableArray(defaultRules), _toConsumableArray(customRules));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function extensions(_ref5, _ref6) {
|
|
63
|
+
var _ref5$extensions = _ref5.extensions,
|
|
64
|
+
defaultExtensions = _ref5$extensions === void 0 ? [] : _ref5$extensions;
|
|
65
|
+
var _ref6$extensions = _ref6.extensions,
|
|
66
|
+
customExtensions = _ref6$extensions === void 0 ? [] : _ref6$extensions;
|
|
67
|
+
return [].concat(_toConsumableArray(defaultExtensions), _toConsumableArray(customExtensions));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function alias(_ref7, _ref8) {
|
|
71
|
+
var _ref7$alias = _ref7.alias,
|
|
72
|
+
defaultAlias = _ref7$alias === void 0 ? {} : _ref7$alias;
|
|
73
|
+
var _ref8$alias = _ref8.alias,
|
|
74
|
+
customAlias = _ref8$alias === void 0 ? {} : _ref8$alias;
|
|
75
|
+
return Object.assign({}, defaultAlias, customAlias);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function _module(_ref9, _ref10) {
|
|
79
|
+
var _ref9$module = _ref9.module,
|
|
80
|
+
defaultModule = _ref9$module === void 0 ? {
|
|
81
|
+
rules: []
|
|
82
|
+
} : _ref9$module;
|
|
83
|
+
var _ref10$module = _ref10.module,
|
|
84
|
+
customModule = _ref10$module === void 0 ? {
|
|
85
|
+
rules: []
|
|
86
|
+
} : _ref10$module;
|
|
87
|
+
return Object.assign({}, defaultModule, customModule, {
|
|
88
|
+
rules: rules(defaultModule, customModule)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function resolve(_ref11, _ref12) {
|
|
93
|
+
var _ref11$resolve = _ref11.resolve,
|
|
94
|
+
defaultResolve = _ref11$resolve === void 0 ? {} : _ref11$resolve;
|
|
95
|
+
var _ref12$resolve = _ref12.resolve,
|
|
96
|
+
customResolve = _ref12$resolve === void 0 ? {} : _ref12$resolve;
|
|
97
|
+
return Object.assign({}, defaultResolve, customResolve, {
|
|
98
|
+
alias: alias(defaultResolve, customResolve),
|
|
99
|
+
extensions: extensions(defaultResolve, customResolve)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function optimization(_ref13, _ref14) {
|
|
104
|
+
var _ref13$optimization = _ref13.optimization,
|
|
105
|
+
defaultOptimization = _ref13$optimization === void 0 ? {} : _ref13$optimization;
|
|
106
|
+
var _ref14$optimization = _ref14.optimization,
|
|
107
|
+
customOptimization = _ref14$optimization === void 0 ? {} : _ref14$optimization;
|
|
108
|
+
return Object.assign({}, defaultOptimization, customOptimization);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function mergeConfigs(config, customConfig) {
|
|
112
|
+
return Object.assign({}, customConfig, config, {
|
|
113
|
+
devtool: customConfig.devtool || config.devtool,
|
|
114
|
+
plugins: plugins(config, customConfig),
|
|
115
|
+
module: _module(config, customConfig),
|
|
116
|
+
resolve: resolve(config, customConfig),
|
|
117
|
+
optimization: optimization(config, customConfig)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { logger } from '@storybook/node-logger';
|
|
2
|
+
import dedent from 'ts-dedent';
|
|
3
|
+
export const checkWebpackVersion = (webpack, specifier, caption) => {
|
|
4
|
+
if (!webpack.version) {
|
|
5
|
+
logger.info('Skipping webpack version check, no version available');
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (webpack.version !== specifier) {
|
|
10
|
+
logger.warn(dedent`
|
|
11
|
+
Unexpected webpack version in ${caption}:
|
|
12
|
+
- Received '${webpack.version}'
|
|
13
|
+
- Expected '${specifier}'
|
|
14
|
+
|
|
15
|
+
If you're using Webpack 5 in SB6.2 and upgrading, consider: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build
|
|
16
|
+
|
|
17
|
+
For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { serverRequire } from '@storybook/core-common';
|
|
3
|
+
const webpackConfigs = ['webpack.config', 'webpackfile'];
|
|
4
|
+
export const loadCustomWebpackConfig = configDir => serverRequire(webpackConfigs.map(configName => path.resolve(configDir, configName)));
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function plugins({
|
|
2
|
+
plugins: defaultPlugins = []
|
|
3
|
+
}, {
|
|
4
|
+
plugins: customPlugins = []
|
|
5
|
+
}) {
|
|
6
|
+
return [...defaultPlugins, ...customPlugins];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function rules({
|
|
10
|
+
rules: defaultRules = []
|
|
11
|
+
}, {
|
|
12
|
+
rules: customRules = []
|
|
13
|
+
}) {
|
|
14
|
+
return [...defaultRules, ...customRules];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function extensions({
|
|
18
|
+
extensions: defaultExtensions = []
|
|
19
|
+
}, {
|
|
20
|
+
extensions: customExtensions = []
|
|
21
|
+
}) {
|
|
22
|
+
return [...defaultExtensions, ...customExtensions];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function alias({
|
|
26
|
+
alias: defaultAlias = {}
|
|
27
|
+
}, {
|
|
28
|
+
alias: customAlias = {}
|
|
29
|
+
}) {
|
|
30
|
+
return Object.assign({}, defaultAlias, customAlias);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function module({
|
|
34
|
+
module: defaultModule = {
|
|
35
|
+
rules: []
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
module: customModule = {
|
|
39
|
+
rules: []
|
|
40
|
+
}
|
|
41
|
+
}) {
|
|
42
|
+
return Object.assign({}, defaultModule, customModule, {
|
|
43
|
+
rules: rules(defaultModule, customModule)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function resolve({
|
|
48
|
+
resolve: defaultResolve = {}
|
|
49
|
+
}, {
|
|
50
|
+
resolve: customResolve = {}
|
|
51
|
+
}) {
|
|
52
|
+
return Object.assign({}, defaultResolve, customResolve, {
|
|
53
|
+
alias: alias(defaultResolve, customResolve),
|
|
54
|
+
extensions: extensions(defaultResolve, customResolve)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function optimization({
|
|
59
|
+
optimization: defaultOptimization = {}
|
|
60
|
+
}, {
|
|
61
|
+
optimization: customOptimization = {}
|
|
62
|
+
}) {
|
|
63
|
+
return Object.assign({}, defaultOptimization, customOptimization);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function mergeConfigs(config, customConfig) {
|
|
67
|
+
return Object.assign({}, customConfig, config, {
|
|
68
|
+
devtool: customConfig.devtool || config.devtool,
|
|
69
|
+
plugins: plugins(config, customConfig),
|
|
70
|
+
module: module(config, customConfig),
|
|
71
|
+
resolve: resolve(config, customConfig),
|
|
72
|
+
optimization: optimization(config, customConfig)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadCustomWebpackConfig: (configDir: string) => any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Options, StorybookConfig as BaseStorybookConfig } from '@storybook/core-common';
|
|
2
|
+
export type { Options, Preset, BuilderResult, TypescriptOptions } from '@storybook/core-common';
|
|
3
|
+
export interface CommonWebpackConfiguration {
|
|
4
|
+
plugins?: any[];
|
|
5
|
+
module?: {
|
|
6
|
+
rules?: any[];
|
|
7
|
+
};
|
|
8
|
+
resolve?: {
|
|
9
|
+
extensions?: string[];
|
|
10
|
+
mainFields?: string[] | string[][];
|
|
11
|
+
alias?: any;
|
|
12
|
+
};
|
|
13
|
+
optimization?: any;
|
|
14
|
+
devtool?: boolean | string;
|
|
15
|
+
}
|
|
16
|
+
export interface StorybookWebpackConfig<TConfiguration extends CommonWebpackConfiguration> {
|
|
17
|
+
/**
|
|
18
|
+
* Modify or return a custom Webpack config after the Storybook's default configuration
|
|
19
|
+
* has run (mostly used by addons).
|
|
20
|
+
*/
|
|
21
|
+
webpack?: (config: TConfiguration, options: Options) => TConfiguration | Promise<TConfiguration>;
|
|
22
|
+
/**
|
|
23
|
+
* Modify or return a custom Webpack config after every addon has run.
|
|
24
|
+
*/
|
|
25
|
+
webpackFinal?: (config: TConfiguration, options: Options) => TConfiguration | Promise<TConfiguration>;
|
|
26
|
+
}
|
|
27
|
+
export declare type StorybookConfig<TWebpackConfiguration extends CommonWebpackConfiguration = CommonWebpackConfiguration> = BaseStorybookConfig & StorybookWebpackConfig<TWebpackConfiguration>;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@storybook/core-webpack",
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
|
+
"description": "Storybook framework-agnostic API",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"storybook"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/main/lib/core-webpack",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/storybookjs/storybook/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/storybookjs/storybook.git",
|
|
15
|
+
"directory": "lib/core-webpack"
|
|
16
|
+
},
|
|
17
|
+
"funding": {
|
|
18
|
+
"type": "opencollective",
|
|
19
|
+
"url": "https://opencollective.com/storybook"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"main": "dist/cjs/index.js",
|
|
23
|
+
"module": "dist/esm/index.js",
|
|
24
|
+
"types": "dist/types/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/**/*",
|
|
27
|
+
"types/**/*",
|
|
28
|
+
"templates/**/*",
|
|
29
|
+
"*.js",
|
|
30
|
+
"*.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"prepare": "node ../../scripts/prepare.js"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@storybook/core-common": "7.0.0-alpha.0",
|
|
37
|
+
"@storybook/node-logger": "7.0.0-alpha.0",
|
|
38
|
+
"@types/node": "^14.0.10 || ^16.0.0",
|
|
39
|
+
"core-js": "^3.8.2",
|
|
40
|
+
"ts-dedent": "^2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "c82d897ea765da8cf4fbbcc2af1f28c808a93e23"
|
|
46
|
+
}
|