@storybook/builder-webpack5 7.0.0-alpha.26 → 7.0.0-alpha.29

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.
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
10
- var _tsDedent = require("ts-dedent");
11
-
12
10
  var _webpack = require("webpack");
13
11
 
14
12
  var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
@@ -57,17 +55,7 @@ var _default = async function _default(options) {
57
55
  typescriptOptions = options.typescriptOptions,
58
56
  features = options.features,
59
57
  serverChannelUrl = options.serverChannelUrl;
60
- var framework = await presets.apply('framework', undefined);
61
-
62
- if (!framework) {
63
- throw new Error((0, _tsDedent.dedent)`
64
- You must to specify a framework in '.storybook/main.js' config.
65
-
66
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#framework-field-mandatory
67
- `);
68
- }
69
-
70
- var frameworkName = typeof framework === 'string' ? framework : framework.name;
58
+ var frameworkName = await (0, _coreCommon.getFrameworkName)(options);
71
59
  var frameworkOptions = await presets.apply('frameworkOptions');
72
60
  var isProd = configType === 'PRODUCTION';
73
61
  var envs = await presets.apply('env');
@@ -141,10 +129,6 @@ var _default = async function _default(options) {
141
129
 
142
130
  var shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipBabel;
143
131
  var tsCheckOptions = typescriptOptions.checkOptions || {};
144
- var _process$env = process.env,
145
- NODE_OPTIONS = _process$env.NODE_OPTIONS,
146
- NODE_PRESERVE_SYMLINKS = _process$env.NODE_PRESERVE_SYMLINKS;
147
- var isPreservingSymlinks = !!NODE_PRESERVE_SYMLINKS || (NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.includes('--preserve-symlinks'));
148
132
  return {
149
133
  name: 'preview',
150
134
  mode: isProd ? 'production' : 'development',
@@ -165,6 +149,8 @@ var _default = async function _default(options) {
165
149
  },
166
150
  ignoreWarnings: [{
167
151
  message: /export '\S+' was not found in 'global'/
152
+ }, {
153
+ message: /require function is used in a way in which dependencies cannot be statically extracted/
168
154
  }],
169
155
  plugins: [Object.keys(virtualModuleMapping).length > 0 ? new _webpackVirtualModules.default(virtualModuleMapping) : null, new _htmlWebpackPlugin.default({
170
156
  filename: `iframe.html`,
@@ -232,7 +218,7 @@ var _default = async function _default(options) {
232
218
  },
233
219
  // Set webpack to resolve symlinks based on whether the user has asked node to.
234
220
  // This feels like it should be default out-of-the-box in webpack :shrug:
235
- symlinks: !isPreservingSymlinks
221
+ symlinks: !(0, _coreCommon.isPreservingSymlinks)()
236
222
  },
237
223
  optimization: {
238
224
  splitChunks: {
@@ -5,7 +5,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import path from 'path';
8
- import { dedent } from 'ts-dedent';
9
8
  import { DefinePlugin, HotModuleReplacementPlugin, ProgressPlugin, ProvidePlugin } from 'webpack';
10
9
  import HtmlWebpackPlugin from 'html-webpack-plugin'; // @ts-ignore // -- this has typings for webpack4 in it, won't work
11
10
 
@@ -13,7 +12,7 @@ import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
13
12
  import TerserWebpackPlugin from 'terser-webpack-plugin';
14
13
  import VirtualModulePlugin from 'webpack-virtual-modules';
15
14
  import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
16
- import { stringifyProcessEnvs, handlebars, interpolate, normalizeStories, readTemplate, loadPreviewOrConfigFile } from '@storybook/core-common';
15
+ import { stringifyProcessEnvs, handlebars, interpolate, normalizeStories, readTemplate, loadPreviewOrConfigFile, isPreservingSymlinks, getFrameworkName } from '@storybook/core-common';
17
16
  import { toRequireContextString, toImportFn } from '@storybook/core-webpack';
18
17
  import { createBabelLoader } from './babel-loader-preview';
19
18
 
@@ -39,17 +38,7 @@ export default (async function (options) {
39
38
  typescriptOptions = options.typescriptOptions,
40
39
  features = options.features,
41
40
  serverChannelUrl = options.serverChannelUrl;
42
- var framework = await presets.apply('framework', undefined);
43
-
44
- if (!framework) {
45
- throw new Error(dedent`
46
- You must to specify a framework in '.storybook/main.js' config.
47
-
48
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#framework-field-mandatory
49
- `);
50
- }
51
-
52
- var frameworkName = typeof framework === 'string' ? framework : framework.name;
41
+ var frameworkName = await getFrameworkName(options);
53
42
  var frameworkOptions = await presets.apply('frameworkOptions');
54
43
  var isProd = configType === 'PRODUCTION';
55
44
  var envs = await presets.apply('env');
@@ -118,10 +107,6 @@ export default (async function (options) {
118
107
 
119
108
  var shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipBabel;
120
109
  var tsCheckOptions = typescriptOptions.checkOptions || {};
121
- var _process$env = process.env,
122
- NODE_OPTIONS = _process$env.NODE_OPTIONS,
123
- NODE_PRESERVE_SYMLINKS = _process$env.NODE_PRESERVE_SYMLINKS;
124
- var isPreservingSymlinks = !!NODE_PRESERVE_SYMLINKS || (NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.includes('--preserve-symlinks'));
125
110
  return {
126
111
  name: 'preview',
127
112
  mode: isProd ? 'production' : 'development',
@@ -142,6 +127,8 @@ export default (async function (options) {
142
127
  },
143
128
  ignoreWarnings: [{
144
129
  message: /export '\S+' was not found in 'global'/
130
+ }, {
131
+ message: /require function is used in a way in which dependencies cannot be statically extracted/
145
132
  }],
146
133
  plugins: [Object.keys(virtualModuleMapping).length > 0 ? new VirtualModulePlugin(virtualModuleMapping) : null, new HtmlWebpackPlugin({
147
134
  filename: `iframe.html`,
@@ -209,7 +196,7 @@ export default (async function (options) {
209
196
  },
210
197
  // Set webpack to resolve symlinks based on whether the user has asked node to.
211
198
  // This feels like it should be default out-of-the-box in webpack :shrug:
212
- symlinks: !isPreservingSymlinks
199
+ symlinks: !isPreservingSymlinks()
213
200
  },
214
201
  optimization: {
215
202
  splitChunks: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/builder-webpack5",
3
- "version": "7.0.0-alpha.26",
3
+ "version": "7.0.0-alpha.29",
4
4
  "description": "Storybook framework-agnostic API",
5
5
  "keywords": [
6
6
  "storybook"
@@ -34,23 +34,23 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/core": "^7.12.10",
37
- "@storybook/addons": "7.0.0-alpha.26",
38
- "@storybook/api": "7.0.0-alpha.26",
39
- "@storybook/channel-postmessage": "7.0.0-alpha.26",
40
- "@storybook/channel-websocket": "7.0.0-alpha.26",
41
- "@storybook/channels": "7.0.0-alpha.26",
42
- "@storybook/client-api": "7.0.0-alpha.26",
43
- "@storybook/client-logger": "7.0.0-alpha.26",
44
- "@storybook/components": "7.0.0-alpha.26",
45
- "@storybook/core-common": "7.0.0-alpha.26",
46
- "@storybook/core-events": "7.0.0-alpha.26",
47
- "@storybook/core-webpack": "7.0.0-alpha.26",
48
- "@storybook/node-logger": "7.0.0-alpha.26",
49
- "@storybook/preview-web": "7.0.0-alpha.26",
50
- "@storybook/router": "7.0.0-alpha.26",
37
+ "@storybook/addons": "7.0.0-alpha.29",
38
+ "@storybook/api": "7.0.0-alpha.29",
39
+ "@storybook/channel-postmessage": "7.0.0-alpha.29",
40
+ "@storybook/channel-websocket": "7.0.0-alpha.29",
41
+ "@storybook/channels": "7.0.0-alpha.29",
42
+ "@storybook/client-api": "7.0.0-alpha.29",
43
+ "@storybook/client-logger": "7.0.0-alpha.29",
44
+ "@storybook/components": "7.0.0-alpha.29",
45
+ "@storybook/core-common": "7.0.0-alpha.29",
46
+ "@storybook/core-events": "7.0.0-alpha.29",
47
+ "@storybook/core-webpack": "7.0.0-alpha.29",
48
+ "@storybook/node-logger": "7.0.0-alpha.29",
49
+ "@storybook/preview-web": "7.0.0-alpha.29",
50
+ "@storybook/router": "7.0.0-alpha.29",
51
51
  "@storybook/semver": "^7.3.2",
52
- "@storybook/store": "7.0.0-alpha.26",
53
- "@storybook/theming": "7.0.0-alpha.26",
52
+ "@storybook/store": "7.0.0-alpha.29",
53
+ "@storybook/theming": "7.0.0-alpha.29",
54
54
  "@types/node": "^14.0.10 || ^16.0.0",
55
55
  "babel-loader": "^8.2.5",
56
56
  "babel-plugin-named-exports-order": "^0.0.2",
@@ -95,5 +95,5 @@
95
95
  "publishConfig": {
96
96
  "access": "public"
97
97
  },
98
- "gitHead": "e5c9cfe1d0482132e59734d9cfce57477045914f"
98
+ "gitHead": "87ce9b91ce2c7e35a716d2254768fb1a34e777c7"
99
99
  }