@storybook/preset-vue3-webpack 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/dist/cjs/framework-preset-vue3-docs.js +48 -0
- package/dist/cjs/framework-preset-vue3.js +91 -0
- package/dist/cjs/index.js +8 -0
- package/dist/esm/framework-preset-vue3-docs.js +24 -0
- package/dist/esm/framework-preset-vue3.js +42 -0
- package/dist/esm/index.js +1 -0
- package/dist/types/framework-preset-vue3-docs.d.ts +2 -0
- package/dist/types/framework-preset-vue3.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +66 -0
- package/preset.js +1 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# Storybook Webpack preset for Vue3
|
2
|
+
|
3
|
+
This package is a [preset](https://storybook.js.org/docs/vue/addons/writing-presets#presets-api) that configures Storybook's webpack settings for handling Vue3.
|
4
|
+
It's an internal package that's not intended to be used directly by users.
|
5
|
+
|
6
|
+
- More info on [Storybook for Vue3](https://storybook.js.org/docs/vue/get-started/introduction)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.webpackFinal = void 0;
|
7
|
+
|
8
|
+
require("core-js/modules/es.object.to-string.js");
|
9
|
+
|
10
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
11
|
+
|
12
|
+
require("core-js/modules/es.array.includes.js");
|
13
|
+
|
14
|
+
require("core-js/modules/es.string.includes.js");
|
15
|
+
|
16
|
+
require("core-js/modules/es.function.name.js");
|
17
|
+
|
18
|
+
require("core-js/modules/es.object.assign.js");
|
19
|
+
|
20
|
+
var _docsTools = require("@storybook/docs-tools");
|
21
|
+
|
22
|
+
var webpackFinal = function webpackFinal(config, options) {
|
23
|
+
var _options$presetsList;
|
24
|
+
|
25
|
+
if (!(0, _docsTools.hasDocsOrControls)(options)) return config;
|
26
|
+
var vueDocgenOptions = {};
|
27
|
+
(_options$presetsList = options.presetsList) === null || _options$presetsList === void 0 ? void 0 : _options$presetsList.forEach(function (preset) {
|
28
|
+
if (preset.name.includes('addon-docs') && preset.options.vueDocgenOptions) {
|
29
|
+
var appendableOptions = preset.options.vueDocgenOptions;
|
30
|
+
vueDocgenOptions = Object.assign({}, vueDocgenOptions, appendableOptions);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
config.module.rules.push({
|
34
|
+
test: /\.vue$/,
|
35
|
+
loader: require.resolve('vue-docgen-loader', {
|
36
|
+
paths: [require.resolve('@storybook/preset-vue3-webpack')]
|
37
|
+
}),
|
38
|
+
enforce: 'post',
|
39
|
+
options: {
|
40
|
+
docgenOptions: Object.assign({
|
41
|
+
alias: config.resolve.alias
|
42
|
+
}, vueDocgenOptions)
|
43
|
+
}
|
44
|
+
});
|
45
|
+
return config;
|
46
|
+
};
|
47
|
+
|
48
|
+
exports.webpackFinal = webpackFinal;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
require("core-js/modules/es.symbol.js");
|
4
|
+
|
5
|
+
require("core-js/modules/es.symbol.description.js");
|
6
|
+
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
8
|
+
|
9
|
+
require("core-js/modules/es.symbol.iterator.js");
|
10
|
+
|
11
|
+
require("core-js/modules/es.array.iterator.js");
|
12
|
+
|
13
|
+
require("core-js/modules/es.string.iterator.js");
|
14
|
+
|
15
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
16
|
+
|
17
|
+
require("core-js/modules/es.array.from.js");
|
18
|
+
|
19
|
+
require("core-js/modules/es.array.slice.js");
|
20
|
+
|
21
|
+
require("core-js/modules/es.function.name.js");
|
22
|
+
|
23
|
+
require("core-js/modules/es.regexp.exec.js");
|
24
|
+
|
25
|
+
Object.defineProperty(exports, "__esModule", {
|
26
|
+
value: true
|
27
|
+
});
|
28
|
+
exports.webpack = void 0;
|
29
|
+
|
30
|
+
require("core-js/modules/es.object.assign.js");
|
31
|
+
|
32
|
+
require("core-js/modules/es.array.concat.js");
|
33
|
+
|
34
|
+
var _vueLoader = require("vue-loader");
|
35
|
+
|
36
|
+
var _webpack = require("webpack");
|
37
|
+
|
38
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
39
|
+
|
40
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
41
|
+
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
43
|
+
|
44
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
45
|
+
|
46
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
47
|
+
|
48
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
49
|
+
|
50
|
+
var webpack = function webpack(config) {
|
51
|
+
return Object.assign({}, config, {
|
52
|
+
plugins: [].concat(_toConsumableArray(config.plugins), [new _vueLoader.VueLoaderPlugin(), new _webpack.DefinePlugin({
|
53
|
+
__VUE_OPTIONS_API__: JSON.stringify(true),
|
54
|
+
__VUE_PROD_DEVTOOLS__: JSON.stringify(true)
|
55
|
+
})]),
|
56
|
+
module: Object.assign({}, config.module, {
|
57
|
+
rules: [].concat(_toConsumableArray(config.module.rules), [{
|
58
|
+
test: /\.vue$/,
|
59
|
+
loader: require.resolve('vue-loader'),
|
60
|
+
options: {}
|
61
|
+
}, {
|
62
|
+
test: /\.ts$/,
|
63
|
+
use: [{
|
64
|
+
loader: require.resolve('ts-loader'),
|
65
|
+
options: {
|
66
|
+
transpileOnly: true,
|
67
|
+
appendTsSuffixTo: [/\.vue$/]
|
68
|
+
}
|
69
|
+
}]
|
70
|
+
}, {
|
71
|
+
test: /\.tsx$/,
|
72
|
+
use: [{
|
73
|
+
loader: require.resolve('ts-loader'),
|
74
|
+
options: {
|
75
|
+
transpileOnly: true,
|
76
|
+
// Note this is different from the `appendTsSuffixTo` above!
|
77
|
+
appendTsxSuffixTo: [/\.vue$/]
|
78
|
+
}
|
79
|
+
}]
|
80
|
+
}])
|
81
|
+
}),
|
82
|
+
resolve: Object.assign({}, config.resolve, {
|
83
|
+
extensions: [].concat(_toConsumableArray(config.resolve.extensions), ['.vue']),
|
84
|
+
alias: Object.assign({}, config.resolve.alias, {
|
85
|
+
vue$: require.resolve('vue/dist/vue.esm-bundler.js')
|
86
|
+
})
|
87
|
+
})
|
88
|
+
});
|
89
|
+
};
|
90
|
+
|
91
|
+
exports.webpack = webpack;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { hasDocsOrControls } from '@storybook/docs-tools';
|
2
|
+
export const webpackFinal = (config, options) => {
|
3
|
+
if (!hasDocsOrControls(options)) return config;
|
4
|
+
let vueDocgenOptions = {};
|
5
|
+
options.presetsList?.forEach(preset => {
|
6
|
+
if (preset.name.includes('addon-docs') && preset.options.vueDocgenOptions) {
|
7
|
+
const appendableOptions = preset.options.vueDocgenOptions;
|
8
|
+
vueDocgenOptions = Object.assign({}, vueDocgenOptions, appendableOptions);
|
9
|
+
}
|
10
|
+
});
|
11
|
+
config.module.rules.push({
|
12
|
+
test: /\.vue$/,
|
13
|
+
loader: require.resolve('vue-docgen-loader', {
|
14
|
+
paths: [require.resolve('@storybook/preset-vue3-webpack')]
|
15
|
+
}),
|
16
|
+
enforce: 'post',
|
17
|
+
options: {
|
18
|
+
docgenOptions: Object.assign({
|
19
|
+
alias: config.resolve.alias
|
20
|
+
}, vueDocgenOptions)
|
21
|
+
}
|
22
|
+
});
|
23
|
+
return config;
|
24
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { VueLoaderPlugin } from 'vue-loader';
|
2
|
+
import { DefinePlugin } from 'webpack';
|
3
|
+
export const webpack = config => {
|
4
|
+
return Object.assign({}, config, {
|
5
|
+
plugins: [...config.plugins, new VueLoaderPlugin(), new DefinePlugin({
|
6
|
+
__VUE_OPTIONS_API__: JSON.stringify(true),
|
7
|
+
__VUE_PROD_DEVTOOLS__: JSON.stringify(true)
|
8
|
+
})],
|
9
|
+
module: Object.assign({}, config.module, {
|
10
|
+
rules: [...config.module.rules, {
|
11
|
+
test: /\.vue$/,
|
12
|
+
loader: require.resolve('vue-loader'),
|
13
|
+
options: {}
|
14
|
+
}, {
|
15
|
+
test: /\.ts$/,
|
16
|
+
use: [{
|
17
|
+
loader: require.resolve('ts-loader'),
|
18
|
+
options: {
|
19
|
+
transpileOnly: true,
|
20
|
+
appendTsSuffixTo: [/\.vue$/]
|
21
|
+
}
|
22
|
+
}]
|
23
|
+
}, {
|
24
|
+
test: /\.tsx$/,
|
25
|
+
use: [{
|
26
|
+
loader: require.resolve('ts-loader'),
|
27
|
+
options: {
|
28
|
+
transpileOnly: true,
|
29
|
+
// Note this is different from the `appendTsSuffixTo` above!
|
30
|
+
appendTsxSuffixTo: [/\.vue$/]
|
31
|
+
}
|
32
|
+
}]
|
33
|
+
}]
|
34
|
+
}),
|
35
|
+
resolve: Object.assign({}, config.resolve, {
|
36
|
+
extensions: [...config.resolve.extensions, '.vue'],
|
37
|
+
alias: Object.assign({}, config.resolve.alias, {
|
38
|
+
vue$: require.resolve('vue/dist/vue.esm-bundler.js')
|
39
|
+
})
|
40
|
+
})
|
41
|
+
});
|
42
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export const addons = [require.resolve('./framework-preset-vue3'), require.resolve('./framework-preset-vue3-docs')];
|
package/package.json
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
{
|
2
|
+
"name": "@storybook/preset-vue3-webpack",
|
3
|
+
"version": "7.0.0-alpha.0",
|
4
|
+
"description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.",
|
5
|
+
"keywords": [
|
6
|
+
"storybook"
|
7
|
+
],
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/main/presets/vue3-webpack",
|
9
|
+
"bugs": {
|
10
|
+
"url": "https://github.com/storybookjs/storybook/issues"
|
11
|
+
},
|
12
|
+
"repository": {
|
13
|
+
"type": "git",
|
14
|
+
"url": "https://github.com/storybookjs/storybook.git",
|
15
|
+
"directory": "presets/vue3-webpack"
|
16
|
+
},
|
17
|
+
"funding": {
|
18
|
+
"type": "opencollective",
|
19
|
+
"url": "https://opencollective.com/storybook"
|
20
|
+
},
|
21
|
+
"license": "MIT",
|
22
|
+
"main": "dist/cjs/index.js",
|
23
|
+
"module": "dist/esm/index.js",
|
24
|
+
"types": "dist/types/index.d.ts",
|
25
|
+
"files": [
|
26
|
+
"bin/**/*",
|
27
|
+
"dist/**/*",
|
28
|
+
"README.md",
|
29
|
+
"*.js",
|
30
|
+
"*.d.ts"
|
31
|
+
],
|
32
|
+
"scripts": {
|
33
|
+
"prepare": "node ../../scripts/prepare.js"
|
34
|
+
},
|
35
|
+
"dependencies": {
|
36
|
+
"@storybook/core-webpack": "7.0.0-alpha.0",
|
37
|
+
"@storybook/docs-tools": "7.0.0-alpha.0",
|
38
|
+
"@types/node": "^14.14.20 || ^16.0.0",
|
39
|
+
"core-js": "^3.8.2",
|
40
|
+
"react": "16.14.0",
|
41
|
+
"react-dom": "16.14.0",
|
42
|
+
"regenerator-runtime": "^0.13.7",
|
43
|
+
"ts-loader": "^9.2.8",
|
44
|
+
"vue-docgen-api": "^4.46.0",
|
45
|
+
"vue-docgen-loader": "^1.5.1",
|
46
|
+
"vue-loader": "^16.0.0",
|
47
|
+
"webpack": "5"
|
48
|
+
},
|
49
|
+
"devDependencies": {
|
50
|
+
"@vue/compiler-sfc": "^3.2.33",
|
51
|
+
"vue": "^3.2.33"
|
52
|
+
},
|
53
|
+
"peerDependencies": {
|
54
|
+
"@babel/core": "*",
|
55
|
+
"@vue/compiler-sfc": "^3.0.0",
|
56
|
+
"babel-loader": "^7.0.0 || ^8.0.0",
|
57
|
+
"vue": "^3.0.0"
|
58
|
+
},
|
59
|
+
"engines": {
|
60
|
+
"node": ">=10.13.0"
|
61
|
+
},
|
62
|
+
"publishConfig": {
|
63
|
+
"access": "public"
|
64
|
+
},
|
65
|
+
"gitHead": "c82d897ea765da8cf4fbbcc2af1f28c808a93e23"
|
66
|
+
}
|
package/preset.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./dist/cjs/index');
|