From 2828e236fa3641ee9c7e0bee48b915cb56531a63 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 27 Jan 2020 21:10:15 +0100 Subject: [PATCH 01/13] MOVE babel-loader_function to preview folder & ADD COPY of tailored for manager The big change is that now, the babel presets & plugins used for storybook (react) code are ensured for manager injected code This means addons referenced from preview.js & manager.js will load with babel config including react preset, etc. --- lib/core/package.json | 2 + .../server/manager/babel-loader-manager.js | 37 ++++++ .../server/manager/manager-webpack.config.js | 2 +- .../babel-loader-preview.js} | 0 .../server/preview/iframe-webpack.config.js | 2 +- yarn.lock | 122 +++++++++++++++++- 6 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 lib/core/src/server/manager/babel-loader-manager.js rename lib/core/src/server/{common/babel-loader.js => preview/babel-loader-preview.js} (100%) diff --git a/lib/core/package.json b/lib/core/package.json index 049ebefcd003..2500b7145d2e 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -32,6 +32,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-transform-react-constant-elements": "^7.2.0", "@babel/preset-env": "^7.4.5", + "@babel/preset-react": "^7.8.3", "@storybook/addons": "6.0.0-alpha.1", "@storybook/channel-postmessage": "6.0.0-alpha.1", "@storybook/client-api": "6.0.0-alpha.1", @@ -45,6 +46,7 @@ "airbnb-js-shims": "^2.2.1", "ansi-to-html": "^0.6.11", "autoprefixer": "^9.7.2", + "babel-merge": "^3.0.0", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-emotion": "^10.0.20", "babel-plugin-macros": "^2.7.0", diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js new file mode 100644 index 000000000000..7aa3c4a77ab3 --- /dev/null +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -0,0 +1,37 @@ +import merge from 'babel-merge'; +import { includePaths, excludePaths } from '../config/utils'; + +export default options => ({ + test: /\.(mjs|jsx?)$/, + use: [ + { + loader: 'babel-loader', + options: { + ...options, + ...merge(options, { + presets: [ + ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], + '@babel/preset-typescript', + '@babel/preset-react', + ], + plugins: [ + [ + '@babel/plugin-proposal-decorators', + { + legacy: true, + }, + ], + ['@babel/plugin-proposal-class-properties', { loose: true }], + '@babel/plugin-proposal-export-default-from', + '@babel/plugin-syntax-dynamic-import', + ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], + 'babel-plugin-macros', + ['emotion', { sourceMap: true, autoLabel: true }], + ], + }), + }, + }, + ], + include: includePaths, + exclude: excludePaths, +}); diff --git a/lib/core/src/server/manager/manager-webpack.config.js b/lib/core/src/server/manager/manager-webpack.config.js index 8516d389317d..e49fb950a211 100644 --- a/lib/core/src/server/manager/manager-webpack.config.js +++ b/lib/core/src/server/manager/manager-webpack.config.js @@ -13,7 +13,7 @@ import findCacheDir from 'find-cache-dir'; import { version } from '../../../package.json'; import { getManagerHeadHtml } from '../utils/template'; import { loadEnv } from '../config/utils'; -import babelLoader from '../common/babel-loader'; +import babelLoader from './babel-loader-manager'; const coreDirName = path.dirname(require.resolve('@storybook/core/package.json')); const context = path.join(coreDirName, '../../node_modules'); diff --git a/lib/core/src/server/common/babel-loader.js b/lib/core/src/server/preview/babel-loader-preview.js similarity index 100% rename from lib/core/src/server/common/babel-loader.js rename to lib/core/src/server/preview/babel-loader-preview.js diff --git a/lib/core/src/server/preview/iframe-webpack.config.js b/lib/core/src/server/preview/iframe-webpack.config.js index 180f35af3394..320de8d9cbc2 100644 --- a/lib/core/src/server/preview/iframe-webpack.config.js +++ b/lib/core/src/server/preview/iframe-webpack.config.js @@ -10,7 +10,7 @@ import VirtualModulePlugin from 'webpack-virtual-modules'; import resolveFrom from 'resolve-from'; -import createBabelLoader from '../common/babel-loader'; +import createBabelLoader from './babel-loader-preview'; import { nodeModulesPaths, loadEnv } from '../config/utils'; import { getPreviewHeadHtml, getPreviewBodyHtml } from '../utils/template'; import { toRequireContextString } from './to-require-context'; diff --git a/yarn.lock b/yarn.lock index 4a60fb4ee7e2..103bd06619b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1586,7 +1586,7 @@ "@babel/plugin-transform-react-jsx-self" "^7.7.4" "@babel/plugin-transform-react-jsx-source" "^7.7.4" -"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.7.0", "@babel/preset-react@^7.7.4": +"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.7.0", "@babel/preset-react@^7.7.4", "@babel/preset-react@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.8.3.tgz#23dc63f1b5b0751283e04252e78cf1d6589273d2" integrity sha512-9hx0CwZg92jGb7iHYQVgi0tOEHP/kM60CtWJQnmbATSPIQQ2xYzfoCI3EdqAhFBeeJwYMdWQuDUHMsuDbH9hyQ== @@ -3321,6 +3321,45 @@ global "^4.3.2" util-deprecate "^1.0.2" +"@storybook/addons@^5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.3.9.tgz#f2492de356e0cd38e3da357f4dafa058a4756e36" + integrity sha512-LrlO6nQ4S6yroFuG9Pn1rXhg0AjT/jx7UKZjZTJNqo4ZdPy88QhQO0ClbOVL+KhUiY773zEBYIk0BvwA3WYtSQ== + dependencies: + "@storybook/api" "5.3.9" + "@storybook/channels" "5.3.9" + "@storybook/client-logger" "5.3.9" + "@storybook/core-events" "5.3.9" + core-js "^3.0.1" + global "^4.3.2" + util-deprecate "^1.0.2" + +"@storybook/api@5.3.9", "@storybook/api@^5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.3.9.tgz#090119c6fd4082442e926a434d3d171535ec6784" + integrity sha512-ix6WS880K5C3H4wjEN0IKqIlVNV0f7zHgvyRf8maL1UFEya5wkBkZg9REDOiCH0tSByzRN73NmPdII3Q1FoAvA== + dependencies: + "@reach/router" "^1.2.1" + "@storybook/channels" "5.3.9" + "@storybook/client-logger" "5.3.9" + "@storybook/core-events" "5.3.9" + "@storybook/csf" "0.0.1" + "@storybook/router" "5.3.9" + "@storybook/theming" "5.3.9" + "@types/reach__router" "^1.2.3" + core-js "^3.0.1" + fast-deep-equal "^2.0.1" + global "^4.3.2" + lodash "^4.17.15" + memoizerific "^1.11.3" + prop-types "^15.6.2" + react "^16.8.3" + semver "^6.0.0" + shallow-equal "^1.1.0" + store2 "^2.7.1" + telejson "^3.2.0" + util-deprecate "^1.0.2" + "@storybook/api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.0.0-alpha.0.tgz#9b612f8c41fb8b1f9bbd3c990b5a1b3beb0eb82a" @@ -3368,6 +3407,13 @@ global "^4.3.2" json-fn "^1.1.1" +"@storybook/channels@5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.3.9.tgz#7ee8f6e6f4c9465227120d6711805b5e6862107f" + integrity sha512-8JFTDTI4hQyAJPDBgwnK99lye2oyxEheko4vD2Pv5M7LblcFBZJuCRhO5wiBsgHi5eV4srSD9kuBsPkYSxB2Xw== + dependencies: + core-js "^3.0.1" + "@storybook/channels@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.0.0-alpha.0.tgz#c86e3bdff2e98444a0e9938a1a4abec503221af4" @@ -3398,6 +3444,13 @@ ts-dedent "^1.1.0" util-deprecate "^1.0.2" +"@storybook/client-logger@5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.3.9.tgz#06654be9caa8d37366270b0426c2d5acb217f504" + integrity sha512-EbA9id/Fk2BZkIWGSICYh+Iu4j7JFRZce4Lp69/MPmHpQk8YKnjL6NdxGsHj/83OFQ9CCbtqNOBzBdtiCy/23w== + dependencies: + core-js "^3.0.1" + "@storybook/client-logger@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.0.0-alpha.0.tgz#c8dd075d5a4a78158f6acb8ace14cf0492f2af16" @@ -3405,6 +3458,40 @@ dependencies: core-js "^3.0.1" +"@storybook/components@^5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.3.9.tgz#1fbc688770889ddadb8c603f5a4dbcf987f3eb0f" + integrity sha512-R4xDR3pIYu7yPHex6DG3PPC3ekLgQuG03ZMQEgCfmWdl2wKXcLtEfQPYLRpC59xnQobfR3wqWgqrGchW54HPow== + dependencies: + "@storybook/client-logger" "5.3.9" + "@storybook/theming" "5.3.9" + "@types/react-syntax-highlighter" "11.0.2" + "@types/react-textarea-autosize" "^4.3.3" + core-js "^3.0.1" + global "^4.3.2" + lodash "^4.17.15" + markdown-to-jsx "^6.9.1" + memoizerific "^1.11.3" + polished "^3.3.1" + popper.js "^1.14.7" + prop-types "^15.7.2" + react "^16.8.3" + react-dom "^16.8.3" + react-focus-lock "^2.1.0" + react-helmet-async "^1.0.2" + react-popper-tooltip "^2.8.3" + react-syntax-highlighter "^11.0.2" + react-textarea-autosize "^7.1.0" + simplebar-react "^1.0.0-alpha.6" + ts-dedent "^1.1.0" + +"@storybook/core-events@5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.3.9.tgz#3c7fbc20204ae4b937c896ed6281e782cc09c4aa" + integrity sha512-JFnVjOHMnxbArIHEGuVvAcQuwf0l2yUJEsx5zJZ6OkCOFXKGDjqATGNtyZEOhVXTwONIWT6Y6ZTfKZLmdiSksQ== + dependencies: + core-js "^3.0.1" + "@storybook/core-events@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.0.0-alpha.0.tgz#a35d2f96f6d38aba080d7f5f1ec67799325728de" @@ -3495,6 +3582,21 @@ emotion-theming "^10.0.19" react-native-swipe-gestures "^1.0.4" +"@storybook/router@5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.3.9.tgz#3c6e01f4dced9de8e8c5c314352fdc437f2441c2" + integrity sha512-z7ptxekGRAXP7hU74wdfeFY/ugrHXtpQcAM1X0k4tvbasJpm+fvqAD3yEYQpfEDL7cLlHEFLbOm6xDqtf1e5qQ== + dependencies: + "@reach/router" "^1.2.1" + "@storybook/csf" "0.0.1" + "@types/reach__router" "^1.2.3" + core-js "^3.0.1" + global "^4.3.2" + lodash "^4.17.15" + memoizerific "^1.11.3" + qs "^6.6.0" + util-deprecate "^1.0.2" + "@storybook/router@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.0.0-alpha.0.tgz#c2b9da6c7eba0dccf32228a72e23ecf8875aacac" @@ -3510,6 +3612,24 @@ qs "^6.6.0" util-deprecate "^1.0.2" +"@storybook/theming@5.3.9", "@storybook/theming@^5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.3.9.tgz#caaeea398f9e630394298ccfe8f36a185a289e4f" + integrity sha512-1vG+H1D5j2vcMv54eEKixAoa4UlTuS/dxMZubJfcZYY1PDNtnvQM6B1CE/4EU+qsIYPFQiGFXB4b6gjCFYIFpQ== + dependencies: + "@emotion/core" "^10.0.20" + "@emotion/styled" "^10.0.17" + "@storybook/client-logger" "5.3.9" + core-js "^3.0.1" + deep-object-diff "^1.1.0" + emotion-theming "^10.0.19" + global "^4.3.2" + memoizerific "^1.11.3" + polished "^3.3.1" + prop-types "^15.7.2" + resolve-from "^5.0.0" + ts-dedent "^1.1.0" + "@storybook/theming@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.0.0-alpha.0.tgz#0a9580cecb1c9609e070c8db7737bd121faf56c3" From 65c06b6a8f5bcea32182156b3b08348a40795048 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 27 Jan 2020 21:22:51 +0100 Subject: [PATCH 02/13] CLEANUP of dependencies & reduce the likely overkill babel config I think emotion & decorators are a bit too opinionated to be injected into everyone's babel config. --- lib/core/package.json | 6 ++++++ lib/core/src/server/manager/babel-loader-manager.js | 7 ------- yarn.lock | 10 +++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/core/package.json b/lib/core/package.json index 2500b7145d2e..03288e67532f 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -33,6 +33,12 @@ "@babel/plugin-transform-react-constant-elements": "^7.2.0", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.8.3", + "@babel/preset-typescript": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-export-default-from":"^7.8.3", + "@babel/plugin-syntax-dynamic-import":"^7.8.3", + "@babel/plugin-proposal-object-rest-spread":"^7.8.3", + "babel-plugin-macros":"^2.8.0", "@storybook/addons": "6.0.0-alpha.1", "@storybook/channel-postmessage": "6.0.0-alpha.1", "@storybook/client-api": "6.0.0-alpha.1", diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js index 7aa3c4a77ab3..edb4dec41597 100644 --- a/lib/core/src/server/manager/babel-loader-manager.js +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -15,18 +15,11 @@ export default options => ({ '@babel/preset-react', ], plugins: [ - [ - '@babel/plugin-proposal-decorators', - { - legacy: true, - }, - ], ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-proposal-export-default-from', '@babel/plugin-syntax-dynamic-import', ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], 'babel-plugin-macros', - ['emotion', { sourceMap: true, autoLabel: true }], ], }), }, diff --git a/yarn.lock b/yarn.lock index 103bd06619b1..ee5821dc097b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -653,7 +653,7 @@ "@babel/helper-create-class-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.5.5", "@babel/plugin-proposal-class-properties@^7.7.0": +"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.5.5", "@babel/plugin-proposal-class-properties@^7.7.0", "@babel/plugin-proposal-class-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== @@ -705,7 +705,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-export-default-from" "^7.2.0" -"@babel/plugin-proposal-export-default-from@^7.2.0", "@babel/plugin-proposal-export-default-from@^7.5.2": +"@babel/plugin-proposal-export-default-from@^7.2.0", "@babel/plugin-proposal-export-default-from@^7.5.2", "@babel/plugin-proposal-export-default-from@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.8.3.tgz#4cb7c2fdeaed490b60d9bfd3dc8a20f81f9c2e7c" integrity sha512-PYtv2S2OdCdp7GSPDg5ndGZFm9DmWFvuLoS5nBxZCgOBggluLnhTScspJxng96alHQzPyrrHxvC9/w4bFuspeA== @@ -777,7 +777,7 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.7.4", "@babel/plugin-proposal-object-rest-spread@^7.8.3": +"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.7.4", "@babel/plugin-proposal-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb" integrity sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA== @@ -838,7 +838,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.7.4", "@babel/plugin-syntax-dynamic-import@^7.8.0": +"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.7.4", "@babel/plugin-syntax-dynamic-import@^7.8.0", "@babel/plugin-syntax-dynamic-import@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== @@ -1605,7 +1605,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.7.4" -"@babel/preset-typescript@^7.1.0", "@babel/preset-typescript@^7.3.3": +"@babel/preset-typescript@^7.1.0", "@babel/preset-typescript@^7.3.3", "@babel/preset-typescript@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.8.3.tgz#90af8690121beecd9a75d0cc26c6be39d1595d13" integrity sha512-qee5LgPGui9zQ0jR1TeU5/fP9L+ovoArklEqY12ek8P/wV5ZeM/VYSQYwICeoT6FfpJTekG9Ilay5PhwsOpMHA== From 48f196edbc0e74cd7d910a34b9ef8ee6cfe147ae Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 29 Jan 2020 17:57:48 +0100 Subject: [PATCH 03/13] FIX lockfile --- yarn.lock | 120 ------------------------------------------------------ 1 file changed, 120 deletions(-) diff --git a/yarn.lock b/yarn.lock index d56a0df5d3b9..9ad6db300e1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3321,45 +3321,6 @@ global "^4.3.2" util-deprecate "^1.0.2" -"@storybook/addons@^5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.3.9.tgz#f2492de356e0cd38e3da357f4dafa058a4756e36" - integrity sha512-LrlO6nQ4S6yroFuG9Pn1rXhg0AjT/jx7UKZjZTJNqo4ZdPy88QhQO0ClbOVL+KhUiY773zEBYIk0BvwA3WYtSQ== - dependencies: - "@storybook/api" "5.3.9" - "@storybook/channels" "5.3.9" - "@storybook/client-logger" "5.3.9" - "@storybook/core-events" "5.3.9" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - -"@storybook/api@5.3.9", "@storybook/api@^5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.3.9.tgz#090119c6fd4082442e926a434d3d171535ec6784" - integrity sha512-ix6WS880K5C3H4wjEN0IKqIlVNV0f7zHgvyRf8maL1UFEya5wkBkZg9REDOiCH0tSByzRN73NmPdII3Q1FoAvA== - dependencies: - "@reach/router" "^1.2.1" - "@storybook/channels" "5.3.9" - "@storybook/client-logger" "5.3.9" - "@storybook/core-events" "5.3.9" - "@storybook/csf" "0.0.1" - "@storybook/router" "5.3.9" - "@storybook/theming" "5.3.9" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - fast-deep-equal "^2.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - prop-types "^15.6.2" - react "^16.8.3" - semver "^6.0.0" - shallow-equal "^1.1.0" - store2 "^2.7.1" - telejson "^3.2.0" - util-deprecate "^1.0.2" - "@storybook/api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.0.0-alpha.0.tgz#9b612f8c41fb8b1f9bbd3c990b5a1b3beb0eb82a" @@ -3407,13 +3368,6 @@ global "^4.3.2" json-fn "^1.1.1" -"@storybook/channels@5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.3.9.tgz#7ee8f6e6f4c9465227120d6711805b5e6862107f" - integrity sha512-8JFTDTI4hQyAJPDBgwnK99lye2oyxEheko4vD2Pv5M7LblcFBZJuCRhO5wiBsgHi5eV4srSD9kuBsPkYSxB2Xw== - dependencies: - core-js "^3.0.1" - "@storybook/channels@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.0.0-alpha.0.tgz#c86e3bdff2e98444a0e9938a1a4abec503221af4" @@ -3444,13 +3398,6 @@ ts-dedent "^1.1.0" util-deprecate "^1.0.2" -"@storybook/client-logger@5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.3.9.tgz#06654be9caa8d37366270b0426c2d5acb217f504" - integrity sha512-EbA9id/Fk2BZkIWGSICYh+Iu4j7JFRZce4Lp69/MPmHpQk8YKnjL6NdxGsHj/83OFQ9CCbtqNOBzBdtiCy/23w== - dependencies: - core-js "^3.0.1" - "@storybook/client-logger@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.0.0-alpha.0.tgz#c8dd075d5a4a78158f6acb8ace14cf0492f2af16" @@ -3458,40 +3405,6 @@ dependencies: core-js "^3.0.1" -"@storybook/components@^5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.3.9.tgz#1fbc688770889ddadb8c603f5a4dbcf987f3eb0f" - integrity sha512-R4xDR3pIYu7yPHex6DG3PPC3ekLgQuG03ZMQEgCfmWdl2wKXcLtEfQPYLRpC59xnQobfR3wqWgqrGchW54HPow== - dependencies: - "@storybook/client-logger" "5.3.9" - "@storybook/theming" "5.3.9" - "@types/react-syntax-highlighter" "11.0.2" - "@types/react-textarea-autosize" "^4.3.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.1" - memoizerific "^1.11.3" - polished "^3.3.1" - popper.js "^1.14.7" - prop-types "^15.7.2" - react "^16.8.3" - react-dom "^16.8.3" - react-focus-lock "^2.1.0" - react-helmet-async "^1.0.2" - react-popper-tooltip "^2.8.3" - react-syntax-highlighter "^11.0.2" - react-textarea-autosize "^7.1.0" - simplebar-react "^1.0.0-alpha.6" - ts-dedent "^1.1.0" - -"@storybook/core-events@5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.3.9.tgz#3c7fbc20204ae4b937c896ed6281e782cc09c4aa" - integrity sha512-JFnVjOHMnxbArIHEGuVvAcQuwf0l2yUJEsx5zJZ6OkCOFXKGDjqATGNtyZEOhVXTwONIWT6Y6ZTfKZLmdiSksQ== - dependencies: - core-js "^3.0.1" - "@storybook/core-events@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.0.0-alpha.0.tgz#a35d2f96f6d38aba080d7f5f1ec67799325728de" @@ -3582,21 +3495,6 @@ emotion-theming "^10.0.19" react-native-swipe-gestures "^1.0.4" -"@storybook/router@5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.3.9.tgz#3c6e01f4dced9de8e8c5c314352fdc437f2441c2" - integrity sha512-z7ptxekGRAXP7hU74wdfeFY/ugrHXtpQcAM1X0k4tvbasJpm+fvqAD3yEYQpfEDL7cLlHEFLbOm6xDqtf1e5qQ== - dependencies: - "@reach/router" "^1.2.1" - "@storybook/csf" "0.0.1" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - util-deprecate "^1.0.2" - "@storybook/router@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.0.0-alpha.0.tgz#c2b9da6c7eba0dccf32228a72e23ecf8875aacac" @@ -3612,24 +3510,6 @@ qs "^6.6.0" util-deprecate "^1.0.2" -"@storybook/theming@5.3.9", "@storybook/theming@^5.3.9": - version "5.3.9" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.3.9.tgz#caaeea398f9e630394298ccfe8f36a185a289e4f" - integrity sha512-1vG+H1D5j2vcMv54eEKixAoa4UlTuS/dxMZubJfcZYY1PDNtnvQM6B1CE/4EU+qsIYPFQiGFXB4b6gjCFYIFpQ== - dependencies: - "@emotion/core" "^10.0.20" - "@emotion/styled" "^10.0.17" - "@storybook/client-logger" "5.3.9" - core-js "^3.0.1" - deep-object-diff "^1.1.0" - emotion-theming "^10.0.19" - global "^4.3.2" - memoizerific "^1.11.3" - polished "^3.3.1" - prop-types "^15.7.2" - resolve-from "^5.0.0" - ts-dedent "^1.1.0" - "@storybook/theming@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.0.0-alpha.0.tgz#0a9580cecb1c9609e070c8db7737bd121faf56c3" From abb3bfe1b144bc5dd46a206ffd83745d1392394d Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 29 Jan 2020 18:03:38 +0100 Subject: [PATCH 04/13] FIX lockfiles & package.json --- lib/core/package.json | 20 ++++++++------------ yarn.lock | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/core/package.json b/lib/core/package.json index 03288e67532f..ce65561897ba 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -27,18 +27,14 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/plugin-proposal-object-rest-spread": "^7.6.2", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-export-default-from":"^7.8.3", + "@babel/plugin-proposal-object-rest-spread":"^7.8.3", + "@babel/plugin-syntax-dynamic-import":"^7.8.3", "@babel/plugin-transform-react-constant-elements": "^7.2.0", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.8.3", "@babel/preset-typescript": "^7.8.3", - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-export-default-from":"^7.8.3", - "@babel/plugin-syntax-dynamic-import":"^7.8.3", - "@babel/plugin-proposal-object-rest-spread":"^7.8.3", - "babel-plugin-macros":"^2.8.0", "@storybook/addons": "6.0.0-alpha.1", "@storybook/channel-postmessage": "6.0.0-alpha.1", "@storybook/client-api": "6.0.0-alpha.1", @@ -55,7 +51,7 @@ "babel-merge": "^3.0.0", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-emotion": "^10.0.20", - "babel-plugin-macros": "^2.7.0", + "babel-plugin-macros":"^2.8.0", "babel-preset-minify": "^0.5.0 || 0.6.0-alpha.5", "boxen": "^4.1.0", "case-sensitive-paths-webpack-plugin": "^2.2.0", @@ -93,8 +89,8 @@ "raw-loader": "^3.1.0", "react-dev-utils": "^10.0.0", "regenerator-runtime": "^0.13.3", - "resolve": "^1.11.0", "resolve-from": "^5.0.0", + "resolve": "^1.11.0", "semver": "^6.0.0", "serve-favicon": "^2.5.0", "shelljs": "^0.8.3", @@ -104,10 +100,10 @@ "unfetch": "^4.1.0", "url-loader": "^2.0.1", "util-deprecate": "^1.0.2", - "webpack": "^4.33.0", "webpack-dev-middleware": "^3.7.0", "webpack-hot-middleware": "^2.25.0", - "webpack-virtual-modules": "^0.2.0" + "webpack-virtual-modules": "^0.2.0", + "webpack": "^4.33.0" }, "devDependencies": { "mock-fs": "^4.8.0" diff --git a/yarn.lock b/yarn.lock index 9ad6db300e1b..55185eb61e16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5919,7 +5919,7 @@ babel-plugin-macros@2.7.1: cosmiconfig "^6.0.0" resolve "^1.12.0" -babel-plugin-macros@^2.0.0, babel-plugin-macros@^2.7.0: +babel-plugin-macros@^2.0.0, babel-plugin-macros@^2.7.0, babel-plugin-macros@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138" integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg== From 93307640b113fde08bb458996d88d503207af45e Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 29 Jan 2020 18:12:25 +0100 Subject: [PATCH 05/13] SORT package.json --- lib/core/package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/core/package.json b/lib/core/package.json index ce65561897ba..71d20e7f9135 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -28,9 +28,9 @@ }, "dependencies": { "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-export-default-from":"^7.8.3", - "@babel/plugin-proposal-object-rest-spread":"^7.8.3", - "@babel/plugin-syntax-dynamic-import":"^7.8.3", + "@babel/plugin-proposal-export-default-from": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-react-constant-elements": "^7.2.0", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.8.3", @@ -51,7 +51,7 @@ "babel-merge": "^3.0.0", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-emotion": "^10.0.20", - "babel-plugin-macros":"^2.8.0", + "babel-plugin-macros": "^2.8.0", "babel-preset-minify": "^0.5.0 || 0.6.0-alpha.5", "boxen": "^4.1.0", "case-sensitive-paths-webpack-plugin": "^2.2.0", @@ -89,8 +89,8 @@ "raw-loader": "^3.1.0", "react-dev-utils": "^10.0.0", "regenerator-runtime": "^0.13.3", - "resolve-from": "^5.0.0", "resolve": "^1.11.0", + "resolve-from": "^5.0.0", "semver": "^6.0.0", "serve-favicon": "^2.5.0", "shelljs": "^0.8.3", @@ -100,10 +100,10 @@ "unfetch": "^4.1.0", "url-loader": "^2.0.1", "util-deprecate": "^1.0.2", + "webpack": "^4.33.0", "webpack-dev-middleware": "^3.7.0", "webpack-hot-middleware": "^2.25.0", - "webpack-virtual-modules": "^0.2.0", - "webpack": "^4.33.0" + "webpack-virtual-modules": "^0.2.0" }, "devDependencies": { "mock-fs": "^4.8.0" From 55f7f8ea0ab402b5ec21ae87c17d3158f04d69b2 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 29 Jan 2020 21:33:38 +0100 Subject: [PATCH 06/13] FIX ember - seems to merging of preview babel config and manager babel config is just too dangerous, as predicted :( --- lib/core/package.json | 1 - .../server/manager/babel-loader-manager.js | 34 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/core/package.json b/lib/core/package.json index 71d20e7f9135..a6a29116d095 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -48,7 +48,6 @@ "airbnb-js-shims": "^2.2.1", "ansi-to-html": "^0.6.11", "autoprefixer": "^9.7.2", - "babel-merge": "^3.0.0", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-emotion": "^10.0.20", "babel-plugin-macros": "^2.8.0", diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js index edb4dec41597..1c8ecaa092e4 100644 --- a/lib/core/src/server/manager/babel-loader-manager.js +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -1,30 +1,26 @@ -import merge from 'babel-merge'; -import { includePaths, excludePaths } from '../config/utils'; +import { includePaths } from '../config/utils'; -export default options => ({ +export default () => ({ test: /\.(mjs|jsx?)$/, use: [ { loader: 'babel-loader', options: { - ...options, - ...merge(options, { - presets: [ - ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], - '@babel/preset-typescript', - '@babel/preset-react', - ], - plugins: [ - ['@babel/plugin-proposal-class-properties', { loose: true }], - '@babel/plugin-proposal-export-default-from', - '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], - 'babel-plugin-macros', - ], - }), + presets: [ + ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], + '@babel/preset-typescript', + '@babel/preset-react', + ], + plugins: [ + ['@babel/plugin-proposal-class-properties', { loose: true }], + '@babel/plugin-proposal-export-default-from', + '@babel/plugin-syntax-dynamic-import', + ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], + 'babel-plugin-macros', + ], }, }, ], include: includePaths, - exclude: excludePaths, + exclude: /node_module|dist/, }); From 4a7135cc33e254699cf2cc9d00fde7e47c45ac93 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 29 Jan 2020 22:07:28 +0100 Subject: [PATCH 07/13] CLEANUP --- lib/core/src/server/manager/manager-webpack.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/core/src/server/manager/manager-webpack.config.js b/lib/core/src/server/manager/manager-webpack.config.js index e49fb950a211..ba61e7ddd3b9 100644 --- a/lib/core/src/server/manager/manager-webpack.config.js +++ b/lib/core/src/server/manager/manager-webpack.config.js @@ -27,7 +27,6 @@ export default ({ dll, outputDir, cache, - babelOptions, previewUrl, versionCheck, }) => { @@ -86,7 +85,7 @@ export default ({ ].filter(Boolean), module: { rules: [ - babelLoader(babelOptions), + babelLoader(), { test: /\.css$/, use: [ From 0f5b841937c22c59d2de5946403c8f71ead6f085 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 6 Feb 2020 11:12:42 +0100 Subject: [PATCH 08/13] REMOVE babel-6 cli fixture --- lib/cli/test/fixtures/react_babel_6/.babelrc | 4 ---- .../test/fixtures/react_babel_6/index.html | 11 --------- lib/cli/test/fixtures/react_babel_6/index.js | 7 ------ .../test/fixtures/react_babel_6/package.json | 23 ------------------- .../fixtures/react_babel_6/rollup.config.js | 22 ------------------ 5 files changed, 67 deletions(-) delete mode 100644 lib/cli/test/fixtures/react_babel_6/.babelrc delete mode 100644 lib/cli/test/fixtures/react_babel_6/index.html delete mode 100644 lib/cli/test/fixtures/react_babel_6/index.js delete mode 100644 lib/cli/test/fixtures/react_babel_6/package.json delete mode 100644 lib/cli/test/fixtures/react_babel_6/rollup.config.js diff --git a/lib/cli/test/fixtures/react_babel_6/.babelrc b/lib/cli/test/fixtures/react_babel_6/.babelrc deleted file mode 100644 index f93c98353c11..000000000000 --- a/lib/cli/test/fixtures/react_babel_6/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["react"], - "plugins": ["external-helpers"] -} diff --git a/lib/cli/test/fixtures/react_babel_6/index.html b/lib/cli/test/fixtures/react_babel_6/index.html deleted file mode 100644 index bcb2f9489a6f..000000000000 --- a/lib/cli/test/fixtures/react_babel_6/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Hello world - - -
- - - \ No newline at end of file diff --git a/lib/cli/test/fixtures/react_babel_6/index.js b/lib/cli/test/fixtures/react_babel_6/index.js deleted file mode 100644 index 8e5bb96fc9cd..000000000000 --- a/lib/cli/test/fixtures/react_babel_6/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; - -ReactDOM.render( -

Hello, world!

, - document.getElementById('root') -); diff --git a/lib/cli/test/fixtures/react_babel_6/package.json b/lib/cli/test/fixtures/react_babel_6/package.json deleted file mode 100644 index e7471988ceaf..000000000000 --- a/lib/cli/test/fixtures/react_babel_6/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "react-babel-6-fixture", - "version": "1.0.0", - "license": "MIT", - "main": "index.js", - "scripts": { - "build": "rollup -c" - }, - "dependencies": { - "react": "^16.8.3", - "react-dom": "^16.8.3" - }, - "devDependencies": { - "babel-core": "6.26.3", - "babel-plugin-external-helpers": "6.22.0", - "babel-preset-react": "6.24.1", - "rollup": "^1.4.1", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-commonjs": "^9.2.1", - "rollup-plugin-node-resolve": "^4.0.1", - "rollup-plugin-replace": "^2.1.0" - } -} diff --git a/lib/cli/test/fixtures/react_babel_6/rollup.config.js b/lib/cli/test/fixtures/react_babel_6/rollup.config.js deleted file mode 100644 index 2f0639d761fe..000000000000 --- a/lib/cli/test/fixtures/react_babel_6/rollup.config.js +++ /dev/null @@ -1,22 +0,0 @@ -import replace from 'rollup-plugin-replace'; -import commonjs from 'rollup-plugin-commonjs'; -import resolve from 'rollup-plugin-node-resolve'; -import babel from 'rollup-plugin-babel'; - -export default { - input: 'index.js', - output: { - file: 'dist/bundle.js', - format: 'iife' - }, - plugins: [ - replace({ - 'process.env.NODE_ENV': JSON.stringify('production') - }), - commonjs(), - resolve(), - babel({ - exclude: 'node_modules/**' // only transpile our source code - }) - ] -}; From 07eaf935d6ab628d67ca3c6396a44ef1a485439f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 6 Feb 2020 11:34:36 +0100 Subject: [PATCH 09/13] FIX lockfile --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index dd492e6d3b99..b617514fac76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -653,7 +653,7 @@ "@babel/helper-create-class-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.5.5", "@babel/plugin-proposal-class-properties@^7.7.0", "@babel/plugin-proposal-class-properties@^7.8.3": +"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.5.5", "@babel/plugin-proposal-class-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== From 1c4de80a393a426cc81ad79e50ee498eda05167f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 6 Feb 2020 12:00:52 +0100 Subject: [PATCH 10/13] ADD TS support --- lib/core/src/server/manager/babel-loader-manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js index 1c8ecaa092e4..46a061c4c520 100644 --- a/lib/core/src/server/manager/babel-loader-manager.js +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -1,7 +1,7 @@ import { includePaths } from '../config/utils'; export default () => ({ - test: /\.(mjs|jsx?)$/, + test: /\.(mjs|tsx?|jsx?)$/, use: [ { loader: 'babel-loader', @@ -22,5 +22,5 @@ export default () => ({ }, ], include: includePaths, - exclude: /node_module|dist/, + exclude: /\/node_module\/|\/dist\//, }); From b3b5c814af87eabf641255a1cb9db0bca9bd7cdb Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 6 Feb 2020 13:45:49 +0100 Subject: [PATCH 11/13] FIX compilation of node_modules & dist --- lib/core/src/server/manager/babel-loader-manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js index 46a061c4c520..452adf08ce3e 100644 --- a/lib/core/src/server/manager/babel-loader-manager.js +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -6,6 +6,7 @@ export default () => ({ { loader: 'babel-loader', options: { + sourceType: 'unambiguous', presets: [ ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], '@babel/preset-typescript', @@ -22,5 +23,5 @@ export default () => ({ }, ], include: includePaths, - exclude: /\/node_module\/|\/dist\//, + exclude: [/node_module/, /dist/], }); From 072c7be885c19932039a58cebe01560ddf758a25 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 6 Feb 2020 22:28:27 +0100 Subject: [PATCH 12/13] REMOVE the error-throwing marko example story why would do do this to ourselves? --- examples/marko-cli/src/stories/hello.stories.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/marko-cli/src/stories/hello.stories.js b/examples/marko-cli/src/stories/hello.stories.js index a6a717560ad8..1a4ec71f5749 100644 --- a/examples/marko-cli/src/stories/hello.stories.js +++ b/examples/marko-cli/src/stories/hello.stories.js @@ -8,5 +8,3 @@ export default { }; export const Simple = () => ({ input: { name: 'abc', age: 20 } }); -export const Story2 = () => 'NOT A MARKO RENDER_RESULT'; -Story2.story = { name: 'with ERROR!' }; From 997c224d5528235280ced846bdef4cc148a9514b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 7 Feb 2020 11:31:05 +0100 Subject: [PATCH 13/13] FIX paths --- addons/actions/src/manager.tsx | 2 +- lib/core/package.json | 1 + .../server/manager/babel-loader-manager.js | 24 ++++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/actions/src/manager.tsx b/addons/actions/src/manager.tsx index a7bfd9dbf596..d77272be077b 100644 --- a/addons/actions/src/manager.tsx +++ b/addons/actions/src/manager.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import addons from '@storybook/addons'; import ActionLogger from './containers/ActionLogger'; import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants'; diff --git a/lib/core/package.json b/lib/core/package.json index 4ee10860c414..2877c249f8d7 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -48,6 +48,7 @@ "airbnb-js-shims": "^2.2.1", "ansi-to-html": "^0.6.11", "autoprefixer": "^9.7.2", + "babel-loader": "^8.0.6", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-emotion": "^10.0.20", "babel-plugin-macros": "^2.8.0", diff --git a/lib/core/src/server/manager/babel-loader-manager.js b/lib/core/src/server/manager/babel-loader-manager.js index 452adf08ce3e..6086275c7380 100644 --- a/lib/core/src/server/manager/babel-loader-manager.js +++ b/lib/core/src/server/manager/babel-loader-manager.js @@ -4,20 +4,26 @@ export default () => ({ test: /\.(mjs|tsx?|jsx?)$/, use: [ { - loader: 'babel-loader', + loader: require.resolve('babel-loader'), options: { sourceType: 'unambiguous', presets: [ - ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], - '@babel/preset-typescript', - '@babel/preset-react', + [ + require.resolve('@babel/preset-env'), + { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }, + ], + require.resolve('@babel/preset-typescript'), + require.resolve('@babel/preset-react'), ], plugins: [ - ['@babel/plugin-proposal-class-properties', { loose: true }], - '@babel/plugin-proposal-export-default-from', - '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], - 'babel-plugin-macros', + [require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }], + require.resolve('@babel/plugin-proposal-export-default-from'), + require.resolve('@babel/plugin-syntax-dynamic-import'), + [ + require.resolve('@babel/plugin-proposal-object-rest-spread'), + { loose: true, useBuiltIns: true }, + ], + require.resolve('babel-plugin-macros'), ], }, },