@storybook/core-webpack 7.0.0-alpha.53 → 7.0.0-alpha.54
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/index.mjs +15 -15
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
Unexpected webpack version in ${
|
|
3
|
-
- Received '${
|
|
4
|
-
- Expected '${
|
|
1
|
+
import path from"path";import{serverRequire}from"@storybook/core-common";var webpackConfigs=["webpack.config","webpackfile"],loadCustomWebpackConfig=configDir=>serverRequire(webpackConfigs.map(configName=>path.resolve(configDir,configName)));import{logger}from"@storybook/node-logger";import{dedent}from"ts-dedent";var checkWebpackVersion=(webpack,specifier,caption)=>{if(!webpack.version){logger.info("Skipping webpack version check, no version available");return}webpack.version!==specifier&&logger.warn(dedent`
|
|
2
|
+
Unexpected webpack version in ${caption}:
|
|
3
|
+
- Received '${webpack.version}'
|
|
4
|
+
- Expected '${specifier}'
|
|
5
5
|
|
|
6
6
|
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
|
|
7
7
|
|
|
8
8
|
For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting
|
|
9
|
-
`)};function
|
|
9
|
+
`)};function mergePluginsField(defaultPlugins=[],customPlugins=[]){return[...defaultPlugins,...customPlugins]}function mergeRulesField(defaultRules=[],customRules=[]){return[...defaultRules,...customRules]}function mergeExtensionsField({extensions:defaultExtensions=[]},{extensions:customExtensions=[]}){return[...defaultExtensions,...customExtensions]}function mergeAliasField({alias:defaultAlias={}},{alias:customAlias={}}){return{...defaultAlias,...customAlias}}function mergeModuleField(a,b){return{...a,...b,rules:mergeRulesField(a.rules||[],b.rules||[])}}function mergeResolveField({resolve:defaultResolve={}},{resolve:customResolve={}}){return{...defaultResolve,...customResolve,alias:mergeAliasField(defaultResolve,customResolve),extensions:mergeExtensionsField(defaultResolve,customResolve)}}function mergeOptimizationField({optimization:defaultOptimization={}},{optimization:customOptimization={}}){return{...defaultOptimization,...customOptimization}}function mergeConfigs(config,customConfig){return{...customConfig,...config,devtool:customConfig.devtool||config.devtool,plugins:mergePluginsField(config.plugins,customConfig.plugins),module:mergeModuleField(config.module||{},customConfig.module||{}),resolve:mergeResolveField(config,customConfig),optimization:mergeOptimizationField(config,customConfig)}}import{dedent as dedent2}from"ts-dedent";import{globToRegexp}from"@storybook/core-common";function importPipeline(){let importGate=Promise.resolve();return async importFn=>{await importGate;let moduleExportsPromise=importFn();return importGate=importGate.then(async()=>{await moduleExportsPromise}),moduleExportsPromise}}function webpackIncludeRegexp(specifier){let{directory,files}=specifier,directoryWithoutLeadingDots=directory.replace(/^(\.+\/)+/,"/"),webpackIncludeGlob=[".",".."].includes(directory)?files:`${directoryWithoutLeadingDots}/${files}`,webpackIncludeRegexpWithCaret=globToRegexp(webpackIncludeGlob);return new RegExp(webpackIncludeRegexpWithCaret.source.replace(/^\^/,""))}function toImportFnPart(specifier){let{directory,importPathMatcher}=specifier;return dedent2`
|
|
10
10
|
async (path) => {
|
|
11
|
-
if (!${
|
|
11
|
+
if (!${importPathMatcher}.exec(path)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const pathRemainder = path.substring(${
|
|
15
|
+
const pathRemainder = path.substring(${directory.length+1});
|
|
16
16
|
return import(
|
|
17
17
|
/* webpackChunkName: "[request]" */
|
|
18
|
-
/* webpackInclude: ${
|
|
19
|
-
'${
|
|
18
|
+
/* webpackInclude: ${webpackIncludeRegexp(specifier)} */
|
|
19
|
+
'${directory}/' + pathRemainder
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
`}function
|
|
24
|
-
const importPipeline = ${
|
|
23
|
+
`}function toImportFn(stories,{needPipelinedImport}={}){let pipelinedImport="const pipeline = (x) => x();";return needPipelinedImport&&(pipelinedImport=`
|
|
24
|
+
const importPipeline = ${importPipeline};
|
|
25
25
|
const pipeline = importPipeline();
|
|
26
|
-
`),
|
|
27
|
-
${
|
|
26
|
+
`),dedent2`
|
|
27
|
+
${pipelinedImport}
|
|
28
28
|
|
|
29
29
|
const importers = [
|
|
30
|
-
${
|
|
30
|
+
${stories.map(toImportFnPart).join(`,
|
|
31
31
|
`)}
|
|
32
32
|
];
|
|
33
33
|
|
|
@@ -39,4 +39,4 @@ import u from"path";import{serverRequire as m}from"@storybook/core-common";var a
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`}import{globToRegexp as
|
|
42
|
+
`}import{globToRegexp as globToRegexp2}from"@storybook/core-common";var toRequireContext=specifier=>{let{directory,files}=specifier,match=globToRegexp2(`./${files}`);return{path:directory,recursive:files.includes("**")||files.split("/").length>1,match}},toRequireContextString=specifier=>{let{path:p,recursive:r,match:m}=toRequireContext(specifier);return`require.context('${p}', ${r}, ${m})`};export{checkWebpackVersion,loadCustomWebpackConfig,mergeConfigs,toImportFn,toImportFnPart,toRequireContext,toRequireContextString,webpackIncludeRegexp};
|
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.54",
|
|
4
4
|
"description": "Storybook framework-agnostic API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
46
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
47
|
-
"@storybook/types": "7.0.0-alpha.
|
|
45
|
+
"@storybook/core-common": "7.0.0-alpha.54",
|
|
46
|
+
"@storybook/node-logger": "7.0.0-alpha.54",
|
|
47
|
+
"@storybook/types": "7.0.0-alpha.54",
|
|
48
48
|
"@types/node": "^16.0.0",
|
|
49
49
|
"ts-dedent": "^2.0.0"
|
|
50
50
|
},
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
],
|
|
62
62
|
"platform": "node"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "91177d4e27daec556a24ae6223c3cbe17a998d9b"
|
|
65
65
|
}
|