@storybook/builder-webpack5 7.2.2-alpha.1 → 7.2.3
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.
|
@@ -718,17 +718,11 @@ PackageJson$1.NonStandardEntryPoints &
|
|
|
718
718
|
PackageJson$1.TypeScriptConfiguration &
|
|
719
719
|
PackageJson$1.YarnConfiguration &
|
|
720
720
|
PackageJson$1.JSPMConfiguration;
|
|
721
|
-
|
|
722
|
-
type StoryId = string;
|
|
723
|
-
type ComponentTitle = string;
|
|
724
|
-
type StoryName = string;
|
|
725
721
|
type Tag = string;
|
|
726
722
|
interface Parameters {
|
|
727
723
|
[name: string]: any;
|
|
728
724
|
}
|
|
729
725
|
|
|
730
|
-
type ExportName = string;
|
|
731
|
-
type MetaId = string;
|
|
732
726
|
interface StoriesSpecifier {
|
|
733
727
|
/**
|
|
734
728
|
* When auto-titling, what to prefix all generated titles with (default: '')
|
|
@@ -763,83 +757,10 @@ interface IndexedCSFFile {
|
|
|
763
757
|
};
|
|
764
758
|
stories: IndexedStory[];
|
|
765
759
|
}
|
|
766
|
-
|
|
767
|
-
* FIXME: This is a temporary type to allow us to deprecate the old indexer API.
|
|
768
|
-
* We should remove this type and the deprecated indexer API in 8.0.
|
|
769
|
-
*/
|
|
770
|
-
type BaseIndexer = {
|
|
771
|
-
/**
|
|
772
|
-
* A regular expression that should match all files to be handled by this indexer
|
|
773
|
-
*/
|
|
760
|
+
interface StoryIndexer {
|
|
774
761
|
test: RegExp;
|
|
775
|
-
};
|
|
776
|
-
/**
|
|
777
|
-
* An indexer describes which filenames it handles, and how to index each individual file - turning it into an entry in the index.
|
|
778
|
-
*/
|
|
779
|
-
type Indexer = BaseIndexer & {
|
|
780
|
-
/**
|
|
781
|
-
* Indexes a file containing stories or docs.
|
|
782
|
-
* @param fileName The name of the file to index.
|
|
783
|
-
* @param options {@link IndexerOptions} for indexing the file.
|
|
784
|
-
* @returns A promise that resolves to an array of {@link IndexInput} objects.
|
|
785
|
-
*/
|
|
786
|
-
index: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>;
|
|
787
|
-
/**
|
|
788
|
-
* @soonDeprecated Use {@link index} instead
|
|
789
|
-
*/
|
|
790
|
-
indexer?: never;
|
|
791
|
-
};
|
|
792
|
-
type DeprecatedIndexer = BaseIndexer & {
|
|
793
762
|
indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
|
|
794
|
-
|
|
795
|
-
};
|
|
796
|
-
/**
|
|
797
|
-
* @soonDeprecated Use {@link Indexer} instead
|
|
798
|
-
*/
|
|
799
|
-
type StoryIndexer = Indexer | DeprecatedIndexer;
|
|
800
|
-
/**
|
|
801
|
-
* The base input for indexing a story or docs entry.
|
|
802
|
-
*/
|
|
803
|
-
type BaseIndexInput = {
|
|
804
|
-
/** The file to import from e.g. the story file. */
|
|
805
|
-
importPath: Path;
|
|
806
|
-
/** The name of the export to import. */
|
|
807
|
-
exportName: ExportName;
|
|
808
|
-
/** The name of the entry, auto-generated from {@link exportName} if unspecified. */
|
|
809
|
-
name?: StoryName;
|
|
810
|
-
/** The location in the sidebar, auto-generated from {@link importPath} if unspecified. */
|
|
811
|
-
title?: ComponentTitle;
|
|
812
|
-
/**
|
|
813
|
-
* The custom id optionally set at `meta.id` if it needs to differ from the id generated via {@link title}.
|
|
814
|
-
* If unspecified, the meta id will be auto-generated from {@link title}.
|
|
815
|
-
* If specified, the meta in the CSF file _must_ have a matching id set at `meta.id`, to be correctly matched.
|
|
816
|
-
*/
|
|
817
|
-
metaId?: MetaId;
|
|
818
|
-
/** Tags for filtering entries in Storybook and its tools. */
|
|
819
|
-
tags?: Tag[];
|
|
820
|
-
/**
|
|
821
|
-
* The id of the entry, auto-generated from {@link title}/{@link metaId} and {@link exportName} if unspecified.
|
|
822
|
-
* If specified, the story in the CSF file _must_ have a matching id set at `parameters.__id`, to be correctly matched.
|
|
823
|
-
* Only use this if you need to override the auto-generated id.
|
|
824
|
-
*/
|
|
825
|
-
__id?: StoryId;
|
|
826
|
-
};
|
|
827
|
-
/**
|
|
828
|
-
* The input for indexing a story entry.
|
|
829
|
-
*/
|
|
830
|
-
type StoryIndexInput = BaseIndexInput & {
|
|
831
|
-
type: 'story';
|
|
832
|
-
};
|
|
833
|
-
/**
|
|
834
|
-
* The input for indexing a docs entry.
|
|
835
|
-
*/
|
|
836
|
-
type DocsIndexInput = BaseIndexInput & {
|
|
837
|
-
type: 'docs';
|
|
838
|
-
/** Paths to story files that must be pre-loaded for this docs entry. */
|
|
839
|
-
storiesImports?: Path[];
|
|
840
|
-
};
|
|
841
|
-
type IndexInput = StoryIndexInput | DocsIndexInput;
|
|
842
|
-
type Path = string;
|
|
763
|
+
}
|
|
843
764
|
|
|
844
765
|
interface Options$1 {
|
|
845
766
|
allowRegExp: boolean;
|
|
@@ -1142,13 +1063,8 @@ interface StorybookConfig {
|
|
|
1142
1063
|
previewAnnotations?: PresetValue<Entry[]>;
|
|
1143
1064
|
/**
|
|
1144
1065
|
* Process CSF files for the story index.
|
|
1145
|
-
* @soonDeprecated use {@link experimental_indexers} instead
|
|
1146
1066
|
*/
|
|
1147
1067
|
storyIndexers?: PresetValue<StoryIndexer[]>;
|
|
1148
|
-
/**
|
|
1149
|
-
* Process CSF files for the story index.
|
|
1150
|
-
*/
|
|
1151
|
-
experimental_indexers?: PresetValue<Indexer[]>;
|
|
1152
1068
|
/**
|
|
1153
1069
|
* Docs related features in index generation
|
|
1154
1070
|
*/
|
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-4db46294.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-4db46294.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={"@storybook/components/experimental":`${getAbsolutePath("@storybook/components")}/dist/experimental`,...["components","global","manager-api","router","theming"].reduce((acc,sbPackage)=>
|
|
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={"@storybook/components/experimental":`${getAbsolutePath("@storybook/components")}/dist/experimental`,...["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.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "Storybook framework-agnostic API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -55,15 +55,23 @@
|
|
|
55
55
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@babel/core": "^7.22.
|
|
59
|
-
"@storybook/
|
|
60
|
-
"@storybook/
|
|
61
|
-
"@storybook/
|
|
62
|
-
"@storybook/
|
|
63
|
-
"@storybook/
|
|
64
|
-
"@storybook/
|
|
65
|
-
"@storybook/
|
|
66
|
-
"@storybook/
|
|
58
|
+
"@babel/core": "^7.22.9",
|
|
59
|
+
"@storybook/addons": "7.2.3",
|
|
60
|
+
"@storybook/channels": "7.2.3",
|
|
61
|
+
"@storybook/client-api": "7.2.3",
|
|
62
|
+
"@storybook/client-logger": "7.2.3",
|
|
63
|
+
"@storybook/components": "7.2.3",
|
|
64
|
+
"@storybook/core-common": "7.2.3",
|
|
65
|
+
"@storybook/core-events": "7.2.3",
|
|
66
|
+
"@storybook/core-webpack": "7.2.3",
|
|
67
|
+
"@storybook/global": "^5.0.0",
|
|
68
|
+
"@storybook/manager-api": "7.2.3",
|
|
69
|
+
"@storybook/node-logger": "7.2.3",
|
|
70
|
+
"@storybook/preview": "7.2.3",
|
|
71
|
+
"@storybook/preview-api": "7.2.3",
|
|
72
|
+
"@storybook/router": "7.2.3",
|
|
73
|
+
"@storybook/store": "7.2.3",
|
|
74
|
+
"@storybook/theming": "7.2.3",
|
|
67
75
|
"@swc/core": "^1.3.49",
|
|
68
76
|
"@types/node": "^16.0.0",
|
|
69
77
|
"@types/semver": "^7.3.4",
|
|
@@ -101,6 +109,10 @@
|
|
|
101
109
|
"slash": "^5.0.0",
|
|
102
110
|
"typescript": "~4.9.3"
|
|
103
111
|
},
|
|
112
|
+
"peerDependencies": {
|
|
113
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
114
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
115
|
+
},
|
|
104
116
|
"peerDependenciesMeta": {
|
|
105
117
|
"typescript": {
|
|
106
118
|
"optional": true
|