@storybook/react-webpack5 7.0.0-alpha.5 → 7.0.0-alpha.51

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/preset.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var y=Object.create;var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},i=(o,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of b(e))!f.call(o,s)&&s!==r&&a(o,s,{get:()=>e[s],enumerable:!(p=m(e,s))||p.enumerable});return o};var k=(o,e,r)=>(r=o!=null?y(c(o)):{},i(e||!o||!o.__esModule?a(r,"default",{value:o,enumerable:!0}):r,o)),w=o=>i(a({},"__esModule",{value:!0}),o);var j={};l(j,{addons:()=>u,core:()=>g,frameworkOptions:()=>d,webpack:()=>v});module.exports=w(j);var t=k(require("path")),u=[t.default.dirname(require.resolve(t.default.join("@storybook/preset-react-webpack","package.json")))],n={legacyRootApi:!0},d=async(o,e)=>{let r=await e.presets.apply("framework");return typeof r=="string"?{name:r,options:n}:typeof r>"u"?{name:require.resolve("@storybook/react-webpack5"),options:n}:{name:r.name,options:{...n,...r.options}}},g=async(o,e)=>{let r=await e.presets.apply("framework");return{...o,builder:{name:t.default.dirname(require.resolve(t.default.join("@storybook/builder-webpack5","package.json"))),options:typeof r=="string"?{}:r.options.builder||{}},renderer:t.default.dirname(require.resolve(t.default.join("@storybook/react","package.json")))}},v=async o=>{var e;return o.resolve=o.resolve||{},o.resolve.alias={...(e=o.resolve)==null?void 0:e.alias,"@storybook/react":t.default.dirname(require.resolve(t.default.join("@storybook/react","package.json")))},o};0&&(module.exports={addons,core,frameworkOptions,webpack});
@@ -0,0 +1 @@
1
+ var t=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(s,e)=>(typeof require!="undefined"?require:s)[e]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import r from"path";var i=[r.dirname(t.resolve(r.join("@storybook/preset-react-webpack","package.json")))],a={legacyRootApi:!0},k=async(o,s)=>{let e=await s.presets.apply("framework");return typeof e=="string"?{name:e,options:a}:typeof e>"u"?{name:t.resolve("@storybook/react-webpack5"),options:a}:{name:e.name,options:{...a,...e.options}}},y=async(o,s)=>{let e=await s.presets.apply("framework");return{...o,builder:{name:r.dirname(t.resolve(r.join("@storybook/builder-webpack5","package.json"))),options:typeof e=="string"?{}:e.options.builder||{}},renderer:r.dirname(t.resolve(r.join("@storybook/react","package.json")))}},b=async o=>(o.resolve=o.resolve||{},o.resolve.alias={...o.resolve?.alias,"@storybook/react":r.dirname(t.resolve(r.join("@storybook/react","package.json")))},o);export{i as addons,y as core,k as frameworkOptions,b as webpack};
@@ -0,0 +1,27 @@
1
+ import { ReactOptions, StorybookConfig as StorybookConfig$1, TypescriptOptions as TypescriptOptions$1 } from '@storybook/preset-react-webpack';
2
+ import { BuilderOptions, StorybookConfigWebpack, TypescriptOptions } from '@storybook/builder-webpack5';
3
+
4
+ type FrameworkName = '@storybook/react-webpack5';
5
+ type BuilderName = '@storybook/builder-webpack5';
6
+ type FrameworkOptions = ReactOptions & {
7
+ builder?: BuilderOptions;
8
+ };
9
+ type StorybookConfigFramework = {
10
+ framework: FrameworkName | {
11
+ name: FrameworkName;
12
+ options: FrameworkOptions;
13
+ };
14
+ core?: StorybookConfig$1['core'] & {
15
+ builder?: BuilderName | {
16
+ name: BuilderName;
17
+ options: BuilderOptions;
18
+ };
19
+ };
20
+ typescript?: Partial<TypescriptOptions & TypescriptOptions$1> & StorybookConfig$1['typescript'];
21
+ };
22
+ /**
23
+ * The interface for Storybook configuration in `main.ts` files.
24
+ */
25
+ type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
26
+
27
+ export { FrameworkOptions as F, StorybookConfig as S };
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ const path = require('path');
2
+ const baseConfig = require('../../jest.config.node');
3
+
4
+ module.exports = {
5
+ ...baseConfig,
6
+ displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-webpack5",
3
- "version": "7.0.0-alpha.5",
3
+ "version": "7.0.0-alpha.51",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -19,9 +19,26 @@
19
19
  "url": "https://opencollective.com/storybook"
20
20
  },
21
21
  "license": "MIT",
22
- "main": "dist/cjs/index.js",
23
- "module": "dist/esm/index.js",
24
- "types": "dist/types/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "require": "./dist/index.js",
25
+ "import": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts"
27
+ },
28
+ "./preset": {
29
+ "require": "./dist/preset.js",
30
+ "import": "./dist/preset.mjs",
31
+ "types": "./dist/preset.d.ts"
32
+ },
33
+ "./package.json": {
34
+ "require": "./package.json",
35
+ "import": "./package.json",
36
+ "types": "./package.json"
37
+ }
38
+ },
39
+ "main": "dist/index.js",
40
+ "module": "dist/index.mjs",
41
+ "types": "dist/index.d.ts",
25
42
  "files": [
26
43
  "dist/**/*",
27
44
  "types/**/*",
@@ -30,17 +47,18 @@
30
47
  "*.d.ts"
31
48
  ],
32
49
  "scripts": {
33
- "prepare": "node ../../scripts/prepare.js"
50
+ "check": "../../../scripts/node_modules/.bin/tsc --noEmit",
51
+ "prep": "../../../scripts/prepare/bundle.ts"
34
52
  },
35
53
  "dependencies": {
36
- "@storybook/builder-webpack5": "7.0.0-alpha.5",
37
- "@storybook/preset-react-webpack": "7.0.0-alpha.5",
38
- "@storybook/react": "7.0.0-alpha.5",
39
- "@types/node": "^14.14.20 || ^16.0.0",
40
- "core-js": "^3.8.2"
54
+ "@storybook/builder-webpack5": "7.0.0-alpha.51",
55
+ "@storybook/preset-react-webpack": "7.0.0-alpha.51",
56
+ "@storybook/react": "7.0.0-alpha.51",
57
+ "@types/node": "^16.0.0 || ^18.0.0"
41
58
  },
42
59
  "devDependencies": {
43
- "jest-specific-snapshot": "^4.0.0"
60
+ "jest-specific-snapshot": "^6.0.0",
61
+ "typescript": "^4.9.3"
44
62
  },
45
63
  "peerDependencies": {
46
64
  "@babel/core": "^7.11.5",
@@ -61,5 +79,12 @@
61
79
  "publishConfig": {
62
80
  "access": "public"
63
81
  },
64
- "gitHead": "3dd46982823b34d9f37be917b6247631081feff7"
82
+ "bundler": {
83
+ "entries": [
84
+ "./src/index.ts",
85
+ "./src/preset.ts"
86
+ ],
87
+ "platform": "node"
88
+ },
89
+ "gitHead": "4fec76c3f5135854d9834ebc1cf2f1f325696ded"
65
90
  }
package/preset.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./dist/cjs/preset');
1
+ module.exports = require('./dist/preset');
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
package/dist/cjs/index.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _react = require("@storybook/react");
8
-
9
- Object.keys(_react).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _react[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _react[key];
16
- }
17
- });
18
- });
19
-
20
- var _types = require("./types");
21
-
22
- Object.keys(_types).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _types[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function () {
28
- return _types[key];
29
- }
30
- });
31
- });
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.webpack = exports.core = exports.addons = void 0;
7
-
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const addons = [_path.default.dirname(require.resolve(_path.default.join('@storybook/preset-react-webpack', 'package.json'))), _path.default.dirname(require.resolve(_path.default.join('@storybook/react', 'package.json')))];
13
- exports.addons = addons;
14
-
15
- const core = async config => {
16
- return Object.assign({}, config, {
17
- builder: _path.default.dirname(require.resolve(_path.default.join('@storybook/builder-webpack5', 'package.json')))
18
- });
19
- };
20
-
21
- exports.core = core;
22
-
23
- const webpack = async config => {
24
- var _config$resolve;
25
-
26
- // eslint-disable-next-line no-param-reassign
27
- config.resolve = config.resolve || {}; // eslint-disable-next-line no-param-reassign
28
-
29
- config.resolve.alias = Object.assign({}, (_config$resolve = config.resolve) === null || _config$resolve === void 0 ? void 0 : _config$resolve.alias, {
30
- '@storybook/react': _path.default.dirname(require.resolve(_path.default.join('@storybook/react', 'package.json')))
31
- });
32
- return config;
33
- };
34
-
35
- exports.webpack = webpack;
package/dist/cjs/types.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
package/dist/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from '@storybook/react';
2
- export * from './types';
@@ -1,16 +0,0 @@
1
- import path from 'path';
2
- export const addons = [path.dirname(require.resolve(path.join('@storybook/preset-react-webpack', 'package.json'))), path.dirname(require.resolve(path.join('@storybook/react', 'package.json')))];
3
- export const core = async config => {
4
- return Object.assign({}, config, {
5
- builder: path.dirname(require.resolve(path.join('@storybook/builder-webpack5', 'package.json')))
6
- });
7
- };
8
- export const webpack = async config => {
9
- // eslint-disable-next-line no-param-reassign
10
- config.resolve = config.resolve || {}; // eslint-disable-next-line no-param-reassign
11
-
12
- config.resolve.alias = Object.assign({}, config.resolve?.alias, {
13
- '@storybook/react': path.dirname(require.resolve(path.join('@storybook/react', 'package.json')))
14
- });
15
- return config;
16
- };
package/dist/esm/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from '@storybook/react';
2
- export * from './types';
@@ -1,12 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/preset-react-webpack';
2
- export declare const addons: StorybookConfig['addons'];
3
- export declare const core: (config: StorybookConfig['core']) => Promise<{
4
- builder: string;
5
- disableWebpackDefaults?: boolean | undefined;
6
- channelOptions?: Partial<import("telejson").Options> | undefined;
7
- disableProjectJson?: boolean | undefined;
8
- disableTelemetry?: boolean | undefined;
9
- enableCrashReports?: boolean | undefined;
10
- crossOriginIsolated?: boolean | undefined;
11
- }>;
12
- export declare const webpack: StorybookConfig['webpack'];
@@ -1,38 +0,0 @@
1
- import type ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
2
- import type { Configuration } from 'webpack';
3
- import type { StorybookConfig as BaseStorybookConfig } from '@storybook/preset-react-webpack';
4
- export type { BuilderResult } from '@storybook/preset-react-webpack';
5
- /**
6
- * Options for TypeScript usage within Storybook.
7
- */
8
- export declare type TypescriptOptions = BaseStorybookConfig['typescript'] & {
9
- /**
10
- * Configures `fork-ts-checker-webpack-plugin`
11
- */
12
- checkOptions: ForkTsCheckerWebpackPlugin['options'];
13
- };
14
- export interface StorybookTypescriptConfig {
15
- typescript?: Partial<TypescriptOptions>;
16
- }
17
- export interface ReactOptions {
18
- fastRefresh?: boolean;
19
- strictMode?: boolean;
20
- /**
21
- * Use React's legacy root API to mount components
22
- * @description
23
- * React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
24
- * If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
25
- * @default false
26
- */
27
- legacyRootApi?: boolean;
28
- }
29
- export interface StorybookReactConfig {
30
- framework: string | {
31
- name: '@storybook/react-webpack5';
32
- options: ReactOptions;
33
- };
34
- }
35
- /**
36
- * The interface for Storybook configuration in `main.ts` files.
37
- */
38
- export declare type StorybookConfig = BaseStorybookConfig<Configuration> & StorybookReactConfig & StorybookTypescriptConfig;
package/types-6-0.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/client/preview/types-6-0.d';
package/types-7-0.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/client/preview/types-7-0.d';
package/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/index.d';