mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
# Conflicts: # app/preact/src/server/framework-preset-preact.ts # code/examples/preact-kitchen-sink/.storybook/main.ts # code/examples/preact-kitchen-sink/src/stories/test-cases/__snapshots__/test-component.stories.storyshot # code/examples/preact-kitchen-sink/src/stories/test-cases/no-pragma.tsx # code/examples/preact-kitchen-sink/src/stories/test-cases/test-component.stories.tsx # code/examples/preact-kitchen-sink/tsconfig.json
192 lines
4.8 KiB
JavaScript
192 lines
4.8 KiB
JavaScript
const withTests = {
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
corejs: '3',
|
|
targets: { node: 'current' },
|
|
},
|
|
],
|
|
],
|
|
plugins: [
|
|
'@storybook/babel-plugin-require-context-hook',
|
|
'babel-plugin-dynamic-import-node',
|
|
'@babel/plugin-transform-runtime',
|
|
],
|
|
};
|
|
|
|
// type BabelMode = 'cjs' | 'esm';
|
|
|
|
const modules = process.env.BABEL_MODE === 'cjs' ? 'auto' : false;
|
|
|
|
// FIXME: optional chaining introduced in chrome 80, not supported by wepback4
|
|
// https://github.com/webpack/webpack/issues/10227#issuecomment-642734920
|
|
const targets = process.env.BABEL_MODE === 'esm' ? { chrome: '100' } : { node: 'current' };
|
|
|
|
module.exports = {
|
|
compact: false,
|
|
ignore: [
|
|
'../code/lib/codemod/src/transforms/__testfixtures__',
|
|
'../code/lib/postinstall/src/__testfixtures__',
|
|
'../code/**/typings.d.ts',
|
|
],
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
corejs: '3',
|
|
targets,
|
|
modules,
|
|
},
|
|
],
|
|
'@babel/preset-typescript',
|
|
'@babel/preset-react',
|
|
'@babel/preset-flow',
|
|
],
|
|
plugins: [
|
|
[
|
|
'@babel/plugin-proposal-decorators',
|
|
{
|
|
legacy: true,
|
|
},
|
|
],
|
|
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
['@babel/plugin-proposal-private-methods', { loose: true }],
|
|
['@babel/plugin-proposal-private-property-in-object', { 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: 'always' }],
|
|
],
|
|
env: {
|
|
test: withTests,
|
|
},
|
|
overrides: [
|
|
{
|
|
test: '../code/examples/vue-kitchen-sink',
|
|
presets: ['@vue/babel-preset-jsx'],
|
|
env: {
|
|
test: withTests,
|
|
},
|
|
},
|
|
{
|
|
test: './examples/preact-kitchen-sink',
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
corejs: '3',
|
|
targets,
|
|
modules,
|
|
},
|
|
],
|
|
['@babel/preset-typescript'],
|
|
[
|
|
'@babel/preset-react',
|
|
{
|
|
importSource: 'preact',
|
|
runtime: 'automatic',
|
|
},
|
|
],
|
|
'@babel/preset-flow',
|
|
],
|
|
env: { test: withTests },
|
|
},
|
|
{
|
|
test: './lib',
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
corejs: '3',
|
|
modules,
|
|
targets,
|
|
},
|
|
],
|
|
'@babel/preset-react',
|
|
],
|
|
plugins: [
|
|
['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }],
|
|
'@babel/plugin-proposal-export-default-from',
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
|
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
'babel-plugin-macros',
|
|
['@emotion', { sourceMap: true, autoLabel: 'always' }],
|
|
'babel-plugin-add-react-displayname',
|
|
],
|
|
env: {
|
|
test: withTests,
|
|
},
|
|
},
|
|
{
|
|
test: [
|
|
'../code/lib/node-logger',
|
|
'../code/lib/core',
|
|
'../code/lib/core-common',
|
|
'../code/lib/core-server',
|
|
'../code/lib/builder-webpack5',
|
|
'../code/lib/codemod',
|
|
'../code/addons/storyshots',
|
|
'../code/**/src/server/**',
|
|
'../code/**/src/bin/**',
|
|
],
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
targets: {
|
|
node: '14',
|
|
},
|
|
modules,
|
|
corejs: '3',
|
|
},
|
|
],
|
|
],
|
|
plugins: [
|
|
'@emotion',
|
|
'babel-plugin-macros',
|
|
'@babel/plugin-transform-arrow-functions',
|
|
'@babel/plugin-transform-shorthand-properties',
|
|
'@babel/plugin-transform-block-scoping',
|
|
'@babel/plugin-transform-destructuring',
|
|
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
|
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
'@babel/plugin-proposal-object-rest-spread',
|
|
'@babel/plugin-proposal-export-default-from',
|
|
],
|
|
env: {
|
|
test: withTests,
|
|
},
|
|
},
|
|
{
|
|
test: ['**/virtualModuleEntry.template.js'],
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
shippedProposals: true,
|
|
useBuiltIns: 'usage',
|
|
targets: {
|
|
node: '14',
|
|
},
|
|
corejs: '3',
|
|
modules: false,
|
|
},
|
|
],
|
|
],
|
|
},
|
|
],
|
|
};
|