Skip to content

Commit

Permalink
Merge pull request #18534 from storybookjs/future/tsup-renderers-1
Browse files Browse the repository at this point in the history
Build: Use TSUP to compile the renderers
  • Loading branch information
shilman authored Jun 29, 2022
2 parents e3308f6 + a4a8c8a commit cdf7eee
Show file tree
Hide file tree
Showing 29 changed files with 341 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
name: Run @storybook/bench on repro
command: |
cd ../cra-bench
npx @storybook/bench@0.8.0--canary.11.edeef38.0 'echo noop' --label cra
npx @storybook/bench@1.0.0--canary.12.22336b6.0 'echo noop' --label cra
e2e-tests-pnp:
executor:
class: medium
Expand Down
10 changes: 10 additions & 0 deletions lib/builder-webpack5/src/preview/iframe-webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@ export default async (
].filter(Boolean),
module: {
rules: [
{
test: /\.m?js$/,
type: 'javascript/auto',
},
{
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
},
createBabelLoader(babelOptions, typescriptOptions),
{
test: /\.md$/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,16 @@ Object {
},
"test": "/\\\\.(stories|story)\\\\.[tj]sx?$/",
},
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
],
},
"plugins": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,16 @@ Object {
},
"test": "/\\\\.(stories|story)\\\\.[tj]sx?$/",
},
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
],
},
"plugins": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
10 changes: 10 additions & 0 deletions lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
10 changes: 10 additions & 0 deletions lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ Object {
],
"module": Object {
"rules": Array [
Object {
"test": "/\\\\.m?js$/",
"type": "javascript/auto",
},
Object {
"resolve": Object {
"fullySpecified": false,
},
"test": "/\\\\.m?js$/",
},
Object {
"exclude": "NODE_MODULES/",
"include": Array [
Expand Down
14 changes: 14 additions & 0 deletions presets/react-webpack/src/framework-preset-cra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@ export const webpackFinal: StorybookConfig['webpack'] = (config, { presetsList }
checkForNewPreset(presetsList);
}
}
config.module?.rules?.push(
...[
{
test: /\.m?js$/,
type: 'javascript/auto',
},
{
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
},
]
);
return config;
};
32 changes: 28 additions & 4 deletions renderers/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,34 @@
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./preview": {
"require": "./dist/config.js",
"import": "./dist/config.mjs",
"types": "./dist/config.d.ts"
},
"./package.json": {
"require": "./package.json",
"import": "./package.json",
"types": "./package.json"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"README.md",
"*.js",
"*.d.ts"
],
"scripts": {
"prepare": "node ../../scripts/prepare.js"
"prepare": "esrun ../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.6",
Expand All @@ -44,6 +61,9 @@
"react-dom": "16.14.0",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@digitak/esrun": "^3.2.2"
},
"peerDependencies": {
"@babel/core": "*"
},
Expand All @@ -53,5 +73,9 @@
"publishConfig": {
"access": "public"
},
"bundlerEntrypoint": [
"./src/index.ts",
"./src/config.ts"
],
"gitHead": "a88dcca40ba169a373bad33dd76e9a4bd4f1f5ec"
}
2 changes: 1 addition & 1 deletion renderers/html/preview.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/esm/config';
export * from './dist/config';
30 changes: 26 additions & 4 deletions renderers/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,34 @@
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./preview": {
"require": "./dist/config.js",
"import": "./dist/config.mjs",
"types": "./dist/config.d.ts"
},
"./package.json": {
"require": "./package.json",
"import": "./package.json",
"types": "./package.json"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"README.md",
"*.js",
"*.d.ts"
],
"scripts": {
"prepare": "node ../../scripts/prepare.js"
"prepare": "esrun ../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.6",
Expand All @@ -43,6 +60,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@digitak/esrun": "^3.2.2",
"preact": "^10.5.13"
},
"peerDependencies": {
Expand All @@ -54,5 +72,9 @@
"publishConfig": {
"access": "public"
},
"bundlerEntrypoint": [
"./src/index.ts",
"./src/config.ts"
],
"gitHead": "a88dcca40ba169a373bad33dd76e9a4bd4f1f5ec"
}
2 changes: 1 addition & 1 deletion renderers/preact/preview.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/esm/config';
export * from './dist/config';
30 changes: 26 additions & 4 deletions renderers/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,26 @@
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./preview": {
"require": "./dist/config.js",
"import": "./dist/config.mjs",
"types": "./dist/config.d.ts"
},
"./package.json": {
"require": "./package.json",
"import": "./package.json",
"types": "./package.json"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"types/**/*",
Expand All @@ -30,7 +47,7 @@
"*.d.ts"
],
"scripts": {
"prepare": "node ../../scripts/prepare.js"
"prepare": "esrun ../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.6",
Expand All @@ -56,6 +73,7 @@
},
"devDependencies": {
"@babel/core": "^7.11.5",
"@digitak/esrun": "^3.2.2",
"@types/util-deprecate": "^1.0.0"
},
"peerDependencies": {
Expand All @@ -75,5 +93,9 @@
"publishConfig": {
"access": "public"
},
"bundlerEntrypoint": [
"./src/index.ts",
"./src/config.ts"
],
"gitHead": "a88dcca40ba169a373bad33dd76e9a4bd4f1f5ec"
}
2 changes: 1 addition & 1 deletion renderers/react/preview.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/esm/config';
export * from './dist/config.mjs';
Loading

0 comments on commit cdf7eee

Please sign in to comment.