Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject mdx compiler for mdx1 #556

Merged
merged 5 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/lit-ts/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('node:path');
const { mergeConfig } = require('vite');
const postcssLit = require('rollup-plugin-postcss-lit');

Expand All @@ -18,6 +19,16 @@ module.exports = {
return mergeConfig(config, {
// prettier-ignore
plugins: [postcssLit({ include: ['**/*.scss', '**/*.scss\?*'] })],
// because rollup does not respect NODE_PATH, and we have a funky example setup that needs it
build: {
rollupOptions: {
plugins: {
resolveId: function (code) {
if (code === 'react') return path.resolve(require.resolve('react'));
},
},
},
},
});
},
};
22 changes: 11 additions & 11 deletions examples/lit-ts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3220,6 +3220,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3239,16 +3249,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/node-logger@npm:6.5.12, @storybook/node-logger@npm:^6.4.3":
version: 6.5.12
resolution: "@storybook/node-logger@npm:6.5.12"
Expand Down
14 changes: 14 additions & 0 deletions examples/preact/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('node:path');

module.exports = {
framework: '@storybook/preact',
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
Expand All @@ -7,4 +9,16 @@ module.exports = {
// we don't want to muck up the data when we're working on the builder
disableTelemetry: true,
},
async viteFinal(config) {
// because rollup does not respect NODE_PATH, and we have a funky example setup that needs it
config.build.rollupOptions = {
plugins: {
resolveId: function (code) {
if (code === 'react') return path.resolve(require.resolve('react'));
if (code === 'preact/compat') return path.resolve(require.resolve('preact/compat'));
},
},
};
return config;
},
};
22 changes: 11 additions & 11 deletions examples/preact/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2755,7 +2755,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3243,6 +3243,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3262,16 +3272,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/node-logger@npm:6.5.12, @storybook/node-logger@npm:^6.4.3":
version: 6.5.12
resolution: "@storybook/node-logger@npm:6.5.12"
Expand Down
13 changes: 11 additions & 2 deletions examples/react-18/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('node:path');

module.exports = {
framework: '@storybook/react',
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
Expand All @@ -10,8 +12,15 @@ module.exports = {
features: {
storyStoreV7: true,
},
async viteFinal(config, { configType }) {
// customize the Vite config here
async viteFinal(config) {
// because rollup does not respect NODE_PATH
config.build.rollupOptions = {
plugins: {
resolveId: function (code, id) {
if (code === 'react') return path.resolve(require.resolve('react'));
},
},
};
return config;
},
};
22 changes: 11 additions & 11 deletions examples/react-18/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3290,6 +3290,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3309,16 +3319,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/node-logger@npm:6.5.16, @storybook/node-logger@npm:^6.4.3":
version: 6.5.16
resolution: "@storybook/node-logger@npm:6.5.16"
Expand Down
13 changes: 11 additions & 2 deletions examples/react-ts/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('node:path');

module.exports = {
framework: '@storybook/react',
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
Expand All @@ -10,8 +12,15 @@ module.exports = {
features: {
storyStoreV7: true,
},
async viteFinal(config, { configType }) {
// customize the Vite config here
async viteFinal(config) {
// because rollup does not respect NODE_PATH, and we have a funky example setup that needs it
config.build.rollupOptions = {
plugins: {
resolveId: function (code) {
if (code === 'react') return path.resolve(require.resolve('react'));
},
},
};
return config;
},
};
22 changes: 11 additions & 11 deletions examples/react-ts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3478,6 +3478,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3497,16 +3507,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/node-logger@npm:6.5.12, @storybook/node-logger@npm:^6.4.3":
version: 6.5.12
resolution: "@storybook/node-logger@npm:6.5.12"
Expand Down
10 changes: 10 additions & 0 deletions examples/react/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('node:path');

module.exports = {
framework: '@storybook/react',
stories: ['../stories/**/*stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
Expand All @@ -12,6 +14,14 @@ module.exports = {
previewMdx2: true,
},
async viteFinal(config) {
// because rollup does not respect NODE_PATH, and we have a funky example setup that needs it
config.build.rollupOptions = {
plugins: {
resolveId: function (code) {
if (code === 'react') return path.resolve(require.resolve('react'));
},
},
};
return config;
},
};
22 changes: 11 additions & 11 deletions examples/react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2824,7 +2824,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3312,6 +3312,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3331,16 +3341,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx2-csf@npm:next":
version: 1.0.0-next.5
resolution: "@storybook/mdx2-csf@npm:1.0.0-next.5"
Expand Down
13 changes: 10 additions & 3 deletions examples/svelte/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const preprocess = require('svelte-preprocess');
const path = require('node:path');

module.exports = {
framework: '@storybook/svelte',
Expand All @@ -13,8 +13,15 @@ module.exports = {
// On-demand store does not work for .svelte stories, only CSF.
storyStoreV7: false,
},
async viteFinal(config, { configType }) {
// customize the Vite config here
async viteFinal(config) {
// because rollup does not respect NODE_PATH, and we have a funky example setup that needs it
config.build.rollupOptions = {
plugins: {
resolveId: function (code) {
if (code === 'react') return path.resolve(require.resolve('react'));
},
},
};
return config;
},
// @ts-ignore
Expand Down
22 changes: 11 additions & 11 deletions examples/svelte/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2741,7 +2741,7 @@ __metadata:
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.2.1
"@storybook/core-common": ^6.4.3
"@storybook/mdx1-csf": ^1.0.0-next.0
"@storybook/mdx1-csf": 1.0.0-next.0
"@storybook/node-logger": ^6.4.3
"@storybook/semver": ^7.3.2
"@storybook/source-loader": ^6.4.3
Expand Down Expand Up @@ -3229,6 +3229,16 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^0.0.1":
version: 0.0.1
resolution: "@storybook/mdx1-csf@npm:0.0.1"
Expand All @@ -3248,16 +3258,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/mdx1-csf@npm:^1.0.0-next.0":
version: 1.0.0-next.0
resolution: "@storybook/mdx1-csf@npm:1.0.0-next.0"
dependencies:
"@mdx-js/mdx": ^1.6.22
"@mdx-js/react": ^1.6.22
checksum: 4524619df9f412d93e37df05bcdcef40bf3337b8de181a5bcc7ab2051f7afc96e8b9bf4bef8e078d470df81cc4d9d01315cd840e358ca3bfb1102efd595720cd
languageName: node
linkType: hard

"@storybook/node-logger@npm:6.5.12, @storybook/node-logger@npm:^6.4.3":
version: 6.5.12
resolution: "@storybook/node-logger@npm:6.5.12"
Expand Down
Loading