@storybook/builder-webpack5 7.3.2 → 7.4.0-alpha.1
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.
|
@@ -727,6 +727,19 @@ interface Parameters {
|
|
|
727
727
|
[name: string]: any;
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
interface Options$1 {
|
|
731
|
+
allowRegExp: boolean;
|
|
732
|
+
allowFunction: boolean;
|
|
733
|
+
allowSymbol: boolean;
|
|
734
|
+
allowDate: boolean;
|
|
735
|
+
allowUndefined: boolean;
|
|
736
|
+
allowClass: boolean;
|
|
737
|
+
allowError: boolean;
|
|
738
|
+
maxDepth: number;
|
|
739
|
+
space: number | undefined;
|
|
740
|
+
lazyEval: boolean;
|
|
741
|
+
}
|
|
742
|
+
|
|
730
743
|
type ExportName = string;
|
|
731
744
|
type MetaId = string;
|
|
732
745
|
interface StoriesSpecifier {
|
|
@@ -839,19 +852,6 @@ type DocsIndexInput = BaseIndexInput & {
|
|
|
839
852
|
storiesImports?: Path[];
|
|
840
853
|
};
|
|
841
854
|
type IndexInput = StoryIndexInput | DocsIndexInput;
|
|
842
|
-
type Path = string;
|
|
843
|
-
|
|
844
|
-
interface Options$1 {
|
|
845
|
-
allowRegExp: boolean;
|
|
846
|
-
allowFunction: boolean;
|
|
847
|
-
allowSymbol: boolean;
|
|
848
|
-
allowDate: boolean;
|
|
849
|
-
allowUndefined: boolean;
|
|
850
|
-
allowClass: boolean;
|
|
851
|
-
maxDepth: number;
|
|
852
|
-
space: number | undefined;
|
|
853
|
-
lazyEval: boolean;
|
|
854
|
-
}
|
|
855
855
|
|
|
856
856
|
/**
|
|
857
857
|
* ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
|
|
@@ -1176,5 +1176,6 @@ interface StorybookConfig {
|
|
|
1176
1176
|
managerHead?: PresetValue<string>;
|
|
1177
1177
|
}
|
|
1178
1178
|
type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
|
|
1179
|
+
type Path = string;
|
|
1179
1180
|
|
|
1180
1181
|
export { Builder as B, Options as O };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import webpack__default, { Configuration, Stats } from 'webpack';
|
|
2
|
-
import { O as Options$1, B as Builder } from './index.d-
|
|
2
|
+
import { O as Options$1, B as Builder } from './index.d-5318040d.js';
|
|
3
3
|
import { StorybookConfig, Options, BuilderResult as BuilderResult$1 } from '@storybook/core-webpack';
|
|
4
4
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
5
5
|
import 'file-system-cache';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as webpack$1 from 'webpack';
|
|
2
2
|
import { Configuration } from 'webpack';
|
|
3
|
-
import { O as Options } from '../index.d-
|
|
3
|
+
import { O as Options } from '../index.d-5318040d.js';
|
|
4
4
|
import 'file-system-cache';
|
|
5
5
|
import '@babel/core';
|
|
6
6
|
import 'express';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preview_preset_exports={};__export(preview_preset_exports,{babel:()=>babel,entries:()=>entries,previewMainTemplate:()=>previewMainTemplate,webpack:()=>webpack});module.exports=__toCommonJS(preview_preset_exports);var import_path=require("path"),import_webpack=require("webpack"),import_html_webpack_plugin=__toESM(require("html-webpack-plugin")),import_case_sensitive_paths_webpack_plugin=__toESM(require("case-sensitive-paths-webpack-plugin")),import_terser_webpack_plugin=__toESM(require("terser-webpack-plugin")),import_webpack_virtual_modules=__toESM(require("webpack-virtual-modules")),import_fork_ts_checker_webpack_plugin=__toESM(require("fork-ts-checker-webpack-plugin"));function slash(path){return path.startsWith("\\\\?\\")?path:path.replace(/\\/g,"/")}var import_globals=require("@storybook/preview/globals"),import_core_common2=require("@storybook/core-common"),import_core_webpack=require("@storybook/core-webpack"),import_ts_dedent2=require("ts-dedent");var import_core_common=require("@storybook/core-common"),import_ts_dedent=require("ts-dedent"),import_node_logger=require("@storybook/node-logger"),createBabelLoader=(options,typescriptOptions,excludes=[])=>({test:typescriptOptions.skipBabel?/\.(mjs|jsx?)$/:/\.(mjs|tsx?|jsx?)$/,use:[{loader:require.resolve("babel-loader"),options}],include:[(0,import_core_common.getProjectRoot)()],exclude:[/node_modules/,...excludes]}),createSWCLoader=(excludes=[])=>{import_node_logger.logger.warn(import_ts_dedent.dedent`
|
|
2
2
|
The SWC loader is an experimental feature and may change or even be removed at any time.
|
|
3
|
-
`);let config={jsc:{parser:{syntax:"typescript",tsx:!0,dynamicImport:!0}}};return{test:/\.(mjs|cjs|tsx?|jsx?)$/,use:[{loader:require.resolve("swc-loader"),options:config}],include:[(0,import_core_common.getProjectRoot)()],exclude:[/node_modules/,...excludes]}};var getAbsolutePath=input=>(0,import_path.dirname)(require.resolve((0,import_path.join)(input,"package.json"))),storybookPaths={
|
|
3
|
+
`);let config={jsc:{parser:{syntax:"typescript",tsx:!0,dynamicImport:!0}}};return{test:/\.(mjs|cjs|tsx?|jsx?)$/,use:[{loader:require.resolve("swc-loader"),options:config}],include:[(0,import_core_common.getProjectRoot)()],exclude:[/node_modules/,...excludes]}};var getAbsolutePath=input=>(0,import_path.dirname)(require.resolve((0,import_path.join)(input,"package.json"))),storybookPaths={...["components","global","manager-api","router","theming"].reduce((acc,sbPackage)=>({...acc,[`@storybook/${sbPackage}`]:getAbsolutePath(`@storybook/${sbPackage}`)}),{}),"@storybook/api":getAbsolutePath("@storybook/manager-api")},iframe_webpack_config_default=async options=>{var _a;let{outputDir=(0,import_path.join)(".","public"),quiet,packageJson,configType,presets,previewUrl,babelOptions,typescriptOptions,features}=options,isProd=configType==="PRODUCTION",workingDir=process.cwd(),[coreOptions,frameworkOptions,envs,logLevel,headHtmlSnippet,bodyHtmlSnippet,template,docsOptions,entries2,nonNormalizedStories,modulesCount=1e3]=await Promise.all([presets.apply("core"),presets.apply("frameworkOptions"),presets.apply("env"),presets.apply("logLevel",void 0),presets.apply("previewHead"),presets.apply("previewBody"),presets.apply("previewMainTemplate"),presets.apply("docs"),presets.apply("entries",[]),presets.apply("stories",[]),(_a=options.cache)==null?void 0:_a.get("modulesCount").catch(()=>{})]),stories=(0,import_core_common2.normalizeStories)(nonNormalizedStories,{configDir:options.configDir,workingDir}),builderOptions=await(0,import_core_common2.getBuilderOptions)(options),previewAnnotations=[...(await presets.apply("previewAnnotations",[],options)).map(entry=>typeof entry=="object"?entry.absolute:(0,import_path.isAbsolute)(entry)?entry:slash(entry)),(0,import_core_common2.loadPreviewOrConfigFile)(options)].filter(Boolean),virtualModuleMapping={};if(features!=null&&features.storyStoreV7){let storiesFilename="storybook-stories.js",storiesPath=(0,import_path.resolve)((0,import_path.join)(workingDir,storiesFilename)),needPipelinedImport=!!builderOptions.lazyCompilation&&!isProd;virtualModuleMapping[storiesPath]=(0,import_core_webpack.toImportFn)(stories,{needPipelinedImport});let configEntryPath=(0,import_path.resolve)((0,import_path.join)(workingDir,"storybook-config-entry.js"));virtualModuleMapping[configEntryPath]=(0,import_core_common2.handlebars)(await(0,import_core_common2.readTemplate)(require.resolve("@storybook/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars")),{storiesFilename,previewAnnotations}).replace(/\\/g,"\\\\"),entries2.push(configEntryPath)}else{let rendererName=await(0,import_core_common2.getRendererName)(options),rendererInitEntry=(0,import_path.resolve)((0,import_path.join)(workingDir,"storybook-init-renderer-entry.js"));virtualModuleMapping[rendererInitEntry]=`import '${slash(rendererName)}';`,entries2.push(rendererInitEntry);let entryTemplate=await(0,import_core_common2.readTemplate)((0,import_path.join)(__dirname,"..","..","templates","virtualModuleEntry.template.js"));if(previewAnnotations.forEach(previewAnnotationFilename=>{if(!previewAnnotationFilename)return;let entryFilename=previewAnnotationFilename.startsWith(".")?`${previewAnnotationFilename.replace(/(\w)(\/|\\)/g,"$1-")}-generated-config-entry.js`:`${previewAnnotationFilename}-generated-config-entry.js`;virtualModuleMapping[entryFilename]=(0,import_core_common2.interpolate)(entryTemplate,{previewAnnotationFilename}),entries2.push(entryFilename)}),stories.length>0){let storyTemplate=await(0,import_core_common2.readTemplate)((0,import_path.join)(__dirname,"..","..","templates","virtualModuleStory.template.js")),storiesFilename=(0,import_path.resolve)((0,import_path.join)(workingDir,"generated-stories-entry.cjs"));virtualModuleMapping[storiesFilename]=(0,import_core_common2.interpolate)(storyTemplate,{rendererName}).replace("'{{stories}}'",stories.map(import_core_webpack.toRequireContextString).join(",")),entries2.push(storiesFilename)}}let shouldCheckTs=typescriptOptions.check&&!typescriptOptions.skipBabel,tsCheckOptions=typescriptOptions.checkOptions||{},cacheConfig=builderOptions.fsCache?{cache:{type:"filesystem"}}:{},lazyCompilationConfig=builderOptions.lazyCompilation&&!isProd?{lazyCompilation:{entries:!1}}:{};if(!template)throw new Error(import_ts_dedent2.dedent`
|
|
4
4
|
Storybook's Webpack5 builder requires a template to be specified.
|
|
5
5
|
Somehow you've ended up with a falsy value for the template option.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/builder-webpack5",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0-alpha.1",
|
|
4
4
|
"description": "Storybook framework-agnostic API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"templates/**/*",
|
|
49
49
|
"README.md",
|
|
50
50
|
"*.js",
|
|
51
|
-
"*.d.ts"
|
|
51
|
+
"*.d.ts",
|
|
52
|
+
"!src/**/*"
|
|
52
53
|
],
|
|
53
54
|
"scripts": {
|
|
54
55
|
"check": "../../../scripts/prepare/check.ts",
|
|
@@ -56,22 +57,22 @@
|
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"@babel/core": "^7.22.9",
|
|
59
|
-
"@storybook/addons": "7.
|
|
60
|
-
"@storybook/channels": "7.
|
|
61
|
-
"@storybook/client-api": "7.
|
|
62
|
-
"@storybook/client-logger": "7.
|
|
63
|
-
"@storybook/components": "7.
|
|
64
|
-
"@storybook/core-common": "7.
|
|
65
|
-
"@storybook/core-events": "7.
|
|
66
|
-
"@storybook/core-webpack": "7.
|
|
60
|
+
"@storybook/addons": "7.4.0-alpha.1",
|
|
61
|
+
"@storybook/channels": "7.4.0-alpha.1",
|
|
62
|
+
"@storybook/client-api": "7.4.0-alpha.1",
|
|
63
|
+
"@storybook/client-logger": "7.4.0-alpha.1",
|
|
64
|
+
"@storybook/components": "7.4.0-alpha.1",
|
|
65
|
+
"@storybook/core-common": "7.4.0-alpha.1",
|
|
66
|
+
"@storybook/core-events": "7.4.0-alpha.1",
|
|
67
|
+
"@storybook/core-webpack": "7.4.0-alpha.1",
|
|
67
68
|
"@storybook/global": "^5.0.0",
|
|
68
|
-
"@storybook/manager-api": "7.
|
|
69
|
-
"@storybook/node-logger": "7.
|
|
70
|
-
"@storybook/preview": "7.
|
|
71
|
-
"@storybook/preview-api": "7.
|
|
72
|
-
"@storybook/router": "7.
|
|
73
|
-
"@storybook/store": "7.
|
|
74
|
-
"@storybook/theming": "7.
|
|
69
|
+
"@storybook/manager-api": "7.4.0-alpha.1",
|
|
70
|
+
"@storybook/node-logger": "7.4.0-alpha.1",
|
|
71
|
+
"@storybook/preview": "7.4.0-alpha.1",
|
|
72
|
+
"@storybook/preview-api": "7.4.0-alpha.1",
|
|
73
|
+
"@storybook/router": "7.4.0-alpha.1",
|
|
74
|
+
"@storybook/store": "7.4.0-alpha.1",
|
|
75
|
+
"@storybook/theming": "7.4.0-alpha.1",
|
|
75
76
|
"@swc/core": "^1.3.49",
|
|
76
77
|
"@types/node": "^16.0.0",
|
|
77
78
|
"@types/semver": "^7.3.4",
|