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

Addon-docs: Source loader library #7117

Merged
merged 10 commits into from
Jun 25, 2019
2 changes: 2 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = {
},
{
test: './lib',
exclude: './addons/storysource/src/loader',
presets: [
['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }],
'@babel/preset-react',
Expand All @@ -77,6 +78,7 @@ module.exports = {
'./lib/core/src/server',
'./lib/node-logger',
'./lib/codemod',
'./lib/source-loader/src',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directory includes client-side files like preview.js, we shouldn't apply node target to them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll extract the server part there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'./addons/storyshots',
'./addons/storysource/src/loader',
'./app/**/src/server/**',
Expand Down
2 changes: 1 addition & 1 deletion examples/angular-cli/.storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = async ({ config }: { config: any }) => {
test: [/\.stories\.tsx?$/, /index\.ts$/],
loaders: [
{
loader: require.resolve('@storybook/addon-storysource/loader'),
loader: require.resolve('@storybook/source-loader'),
options: {
parser: 'typescript',
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ember-cli/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/ember-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/ember": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"babel-loader": "^8",
"broccoli-asset-rev": "^3.0.0",
"cross-env": "^5.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/html-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../stories')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/html-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@storybook/core": "5.2.0-alpha.23",
"@storybook/core-events": "5.2.0-alpha.23",
"@storybook/html": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"eventemitter3": "^3.1.0",
"format-json": "^1.0.3",
"global": "^4.3.2"
Expand Down
2 changes: 1 addition & 1 deletion examples/marko-cli/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/marko-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@storybook/addon-storysource": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/marko": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"prettier": "^1.16.4",
"webpack": "^4.33.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/mithril-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/mithril-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/mithril": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"webpack": "^4.33.0"
}
}
1 change: 1 addition & 0 deletions examples/official-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@storybook/core-events": "5.2.0-alpha.23",
"@storybook/node-logger": "5.2.0-alpha.23",
"@storybook/react": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"@storybook/theming": "5.2.0-alpha.23",
"cors": "^2.8.5",
"cross-env": "^5.2.0",
Expand Down
9 changes: 7 additions & 2 deletions examples/official-storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ module.exports = async ({ config }) => ({
exclude: [/node_modules/, /dist/],
},
{
test: /\.stories\.jsx?$/,
use: require.resolve('@storybook/addon-storysource/loader'),
test: /\.stories\.[tj]sx?$/,
use: [
{
loader: require.resolve('@storybook/source-loader'),
options: { injectParameters: true },
},
],
include: [
path.resolve(__dirname, './stories'),
path.resolve(__dirname, '../../lib/ui/src'),
Expand Down
2 changes: 1 addition & 1 deletion examples/polymer-cli/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const webpack = require('webpack');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/polymer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@storybook/addon-storysource": "5.2.0-alpha.23",
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/polymer": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"@webcomponents/webcomponentsjs": "^1.2.0",
"global": "^4.3.2",
"lit-html": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/preact-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/preact-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/preact": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"babel-loader": "^8.0.4",
"cross-env": "^5.2.0",
"file-loader": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/rax-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
rules: [
{
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
},
Expand Down
1 change: 1 addition & 0 deletions examples/rax-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/rax": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"babel-eslint": "^8.2.2",
"babel-preset-rax": "^1.0.0-beta.0",
"rax-scripts": "^1.0.0-beta.10",
Expand Down
2 changes: 1 addition & 1 deletion examples/riot-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/riot-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/riot": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"babel-loader": "^8.0.4",
"cross-env": "^5.2.0",
"file-loader": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/svelte-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@storybook/addon-storysource": "5.2.0-alpha.23",
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"@storybook/svelte": "5.2.0-alpha.23"
}
}
2 changes: 1 addition & 1 deletion examples/vue-kitchen-sink/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
module.exports = async ({ config }) => {
config.module.rules.push({
test: [/\.stories\.js$/, /index\.js$/],
loaders: [require.resolve('@storybook/addon-storysource/loader')],
loaders: [require.resolve('@storybook/source-loader')],
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
});
Expand Down
1 change: 1 addition & 0 deletions examples/vue-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@storybook/addon-storysource": "5.2.0-alpha.23",
"@storybook/addon-viewport": "5.2.0-alpha.23",
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/source-loader": "5.2.0-alpha.23",
"@storybook/vue": "5.2.0-alpha.23",
"babel-core": "^7.0.0-bridge.0",
"babel-loader": "^8.0.5",
Expand Down
38 changes: 38 additions & 0 deletions lib/source-loader/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@storybook/source-loader",
"version": "5.2.0-alpha.23",
"description": "Source loader",
"keywords": [
"lib",
"storybook"
],
"homepage": "https://github.com/storybookjs/storybook/tree/master/lib/source-loader",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "lib/source-loader"
},
"license": "MIT",
"main": "dist/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.2.0-alpha.23",
"@storybook/router": "5.2.0-alpha.23",
"core-js": "^3.0.1",
"estraverse": "^4.2.0",
"global": "^4.3.2",
"loader-utils": "^1.2.3",
"prettier": "^1.16.4",
"prop-types": "^15.7.2",
"regenerator-runtime": "^0.12.1"
},
"publishConfig": {
"access": "public"
}
}
Loading