@storybook/core-webpack 7.0.0-alpha.2 → 7.0.0-alpha.5
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/dist/cjs/merge-webpack-config.js +15 -31
- package/dist/esm/merge-webpack-config.js +15 -31
- package/dist/types/types.d.ts +13 -10
- package/package.json +4 -4
|
@@ -5,23 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeConfigs = mergeConfigs;
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
plugins: defaultPlugins = []
|
|
10
|
-
}, {
|
|
11
|
-
plugins: customPlugins = []
|
|
12
|
-
}) {
|
|
8
|
+
function mergePluginsField(defaultPlugins = [], customPlugins = []) {
|
|
13
9
|
return [...defaultPlugins, ...customPlugins];
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
function
|
|
17
|
-
rules: defaultRules = []
|
|
18
|
-
}, {
|
|
19
|
-
rules: customRules = []
|
|
20
|
-
}) {
|
|
12
|
+
function mergeRulesField(defaultRules = [], customRules = []) {
|
|
21
13
|
return [...defaultRules, ...customRules];
|
|
22
14
|
}
|
|
23
15
|
|
|
24
|
-
function
|
|
16
|
+
function mergeExtensionsField({
|
|
25
17
|
extensions: defaultExtensions = []
|
|
26
18
|
}, {
|
|
27
19
|
extensions: customExtensions = []
|
|
@@ -29,7 +21,7 @@ function extensions({
|
|
|
29
21
|
return [...defaultExtensions, ...customExtensions];
|
|
30
22
|
}
|
|
31
23
|
|
|
32
|
-
function
|
|
24
|
+
function mergeAliasField({
|
|
33
25
|
alias: defaultAlias = {}
|
|
34
26
|
}, {
|
|
35
27
|
alias: customAlias = {}
|
|
@@ -37,32 +29,24 @@ function alias({
|
|
|
37
29
|
return Object.assign({}, defaultAlias, customAlias);
|
|
38
30
|
}
|
|
39
31
|
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
rules: []
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
module: customModule = {
|
|
46
|
-
rules: []
|
|
47
|
-
}
|
|
48
|
-
}) {
|
|
49
|
-
return Object.assign({}, defaultModule, customModule, {
|
|
50
|
-
rules: rules(defaultModule, customModule)
|
|
32
|
+
function mergeModuleField(a, b) {
|
|
33
|
+
return Object.assign({}, a, b, {
|
|
34
|
+
rules: mergeRulesField(a.rules || [], b.rules || [])
|
|
51
35
|
});
|
|
52
36
|
}
|
|
53
37
|
|
|
54
|
-
function
|
|
38
|
+
function mergeResolveField({
|
|
55
39
|
resolve: defaultResolve = {}
|
|
56
40
|
}, {
|
|
57
41
|
resolve: customResolve = {}
|
|
58
42
|
}) {
|
|
59
43
|
return Object.assign({}, defaultResolve, customResolve, {
|
|
60
|
-
alias:
|
|
61
|
-
extensions:
|
|
44
|
+
alias: mergeAliasField(defaultResolve, customResolve),
|
|
45
|
+
extensions: mergeExtensionsField(defaultResolve, customResolve)
|
|
62
46
|
});
|
|
63
47
|
}
|
|
64
48
|
|
|
65
|
-
function
|
|
49
|
+
function mergeOptimizationField({
|
|
66
50
|
optimization: defaultOptimization = {}
|
|
67
51
|
}, {
|
|
68
52
|
optimization: customOptimization = {}
|
|
@@ -73,9 +57,9 @@ function optimization({
|
|
|
73
57
|
function mergeConfigs(config, customConfig) {
|
|
74
58
|
return Object.assign({}, customConfig, config, {
|
|
75
59
|
devtool: customConfig.devtool || config.devtool,
|
|
76
|
-
plugins:
|
|
77
|
-
module:
|
|
78
|
-
resolve:
|
|
79
|
-
optimization:
|
|
60
|
+
plugins: mergePluginsField(config.plugins, customConfig.plugins),
|
|
61
|
+
module: mergeModuleField(config.module || {}, customConfig.module || {}),
|
|
62
|
+
resolve: mergeResolveField(config, customConfig),
|
|
63
|
+
optimization: mergeOptimizationField(config, customConfig)
|
|
80
64
|
});
|
|
81
65
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
function
|
|
2
|
-
plugins: defaultPlugins = []
|
|
3
|
-
}, {
|
|
4
|
-
plugins: customPlugins = []
|
|
5
|
-
}) {
|
|
1
|
+
function mergePluginsField(defaultPlugins = [], customPlugins = []) {
|
|
6
2
|
return [...defaultPlugins, ...customPlugins];
|
|
7
3
|
}
|
|
8
4
|
|
|
9
|
-
function
|
|
10
|
-
rules: defaultRules = []
|
|
11
|
-
}, {
|
|
12
|
-
rules: customRules = []
|
|
13
|
-
}) {
|
|
5
|
+
function mergeRulesField(defaultRules = [], customRules = []) {
|
|
14
6
|
return [...defaultRules, ...customRules];
|
|
15
7
|
}
|
|
16
8
|
|
|
17
|
-
function
|
|
9
|
+
function mergeExtensionsField({
|
|
18
10
|
extensions: defaultExtensions = []
|
|
19
11
|
}, {
|
|
20
12
|
extensions: customExtensions = []
|
|
@@ -22,7 +14,7 @@ function extensions({
|
|
|
22
14
|
return [...defaultExtensions, ...customExtensions];
|
|
23
15
|
}
|
|
24
16
|
|
|
25
|
-
function
|
|
17
|
+
function mergeAliasField({
|
|
26
18
|
alias: defaultAlias = {}
|
|
27
19
|
}, {
|
|
28
20
|
alias: customAlias = {}
|
|
@@ -30,32 +22,24 @@ function alias({
|
|
|
30
22
|
return Object.assign({}, defaultAlias, customAlias);
|
|
31
23
|
}
|
|
32
24
|
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
rules: []
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
module: customModule = {
|
|
39
|
-
rules: []
|
|
40
|
-
}
|
|
41
|
-
}) {
|
|
42
|
-
return Object.assign({}, defaultModule, customModule, {
|
|
43
|
-
rules: rules(defaultModule, customModule)
|
|
25
|
+
function mergeModuleField(a, b) {
|
|
26
|
+
return Object.assign({}, a, b, {
|
|
27
|
+
rules: mergeRulesField(a.rules || [], b.rules || [])
|
|
44
28
|
});
|
|
45
29
|
}
|
|
46
30
|
|
|
47
|
-
function
|
|
31
|
+
function mergeResolveField({
|
|
48
32
|
resolve: defaultResolve = {}
|
|
49
33
|
}, {
|
|
50
34
|
resolve: customResolve = {}
|
|
51
35
|
}) {
|
|
52
36
|
return Object.assign({}, defaultResolve, customResolve, {
|
|
53
|
-
alias:
|
|
54
|
-
extensions:
|
|
37
|
+
alias: mergeAliasField(defaultResolve, customResolve),
|
|
38
|
+
extensions: mergeExtensionsField(defaultResolve, customResolve)
|
|
55
39
|
});
|
|
56
40
|
}
|
|
57
41
|
|
|
58
|
-
function
|
|
42
|
+
function mergeOptimizationField({
|
|
59
43
|
optimization: defaultOptimization = {}
|
|
60
44
|
}, {
|
|
61
45
|
optimization: customOptimization = {}
|
|
@@ -66,9 +50,9 @@ function optimization({
|
|
|
66
50
|
export function mergeConfigs(config, customConfig) {
|
|
67
51
|
return Object.assign({}, customConfig, config, {
|
|
68
52
|
devtool: customConfig.devtool || config.devtool,
|
|
69
|
-
plugins:
|
|
70
|
-
module:
|
|
71
|
-
resolve:
|
|
72
|
-
optimization:
|
|
53
|
+
plugins: mergePluginsField(config.plugins, customConfig.plugins),
|
|
54
|
+
module: mergeModuleField(config.module || {}, customConfig.module || {}),
|
|
55
|
+
resolve: mergeResolveField(config, customConfig),
|
|
56
|
+
optimization: mergeOptimizationField(config, customConfig)
|
|
73
57
|
});
|
|
74
58
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import type { Options, StorybookConfig as BaseStorybookConfig } from '@storybook/core-common';
|
|
2
2
|
export type { Options, Preset, BuilderResult, TypescriptOptions } from '@storybook/core-common';
|
|
3
|
+
export declare type RulesConfig = any;
|
|
4
|
+
export declare type ModuleConfig = {
|
|
5
|
+
rules?: RulesConfig[];
|
|
6
|
+
};
|
|
7
|
+
export declare type ResolveConfig = {
|
|
8
|
+
extensions?: string[];
|
|
9
|
+
mainFields?: string[] | string[][];
|
|
10
|
+
alias?: any;
|
|
11
|
+
};
|
|
3
12
|
export interface CommonWebpackConfiguration {
|
|
4
13
|
plugins?: any[];
|
|
5
|
-
module?:
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
resolve?: {
|
|
9
|
-
extensions?: string[];
|
|
10
|
-
mainFields?: string[] | string[][];
|
|
11
|
-
alias?: any;
|
|
12
|
-
};
|
|
14
|
+
module?: ModuleConfig;
|
|
15
|
+
resolve?: ResolveConfig;
|
|
13
16
|
optimization?: any;
|
|
14
17
|
devtool?: boolean | string;
|
|
15
18
|
}
|
|
16
|
-
export interface StorybookWebpackConfig<TConfiguration
|
|
19
|
+
export interface StorybookWebpackConfig<TConfiguration = CommonWebpackConfiguration> {
|
|
17
20
|
/**
|
|
18
21
|
* Modify or return a custom Webpack config after the Storybook's default configuration
|
|
19
22
|
* has run (mostly used by addons).
|
|
@@ -24,4 +27,4 @@ export interface StorybookWebpackConfig<TConfiguration extends CommonWebpackConf
|
|
|
24
27
|
*/
|
|
25
28
|
webpackFinal?: (config: TConfiguration, options: Options) => TConfiguration | Promise<TConfiguration>;
|
|
26
29
|
}
|
|
27
|
-
export declare type StorybookConfig<TWebpackConfiguration
|
|
30
|
+
export declare type StorybookConfig<TWebpackConfiguration = CommonWebpackConfiguration> = BaseStorybookConfig & StorybookWebpackConfig<TWebpackConfiguration>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/core-webpack",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.5",
|
|
4
4
|
"description": "Storybook framework-agnostic API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"prepare": "node ../../scripts/prepare.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
37
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
36
|
+
"@storybook/core-common": "7.0.0-alpha.5",
|
|
37
|
+
"@storybook/node-logger": "7.0.0-alpha.5",
|
|
38
38
|
"@types/node": "^14.0.10 || ^16.0.0",
|
|
39
39
|
"core-js": "^3.8.2",
|
|
40
40
|
"ts-dedent": "^2.0.0"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "3dd46982823b34d9f37be917b6247631081feff7"
|
|
46
46
|
}
|