histoire 0.6.6 → 0.7.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/dist/node/build.js +29 -2
- package/package.json +2 -2
- package/src/node/build.ts +31 -2
package/dist/node/build.js
CHANGED
|
@@ -49,7 +49,7 @@ export async function build(ctx) {
|
|
|
49
49
|
const storyCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ? 1 : 0), 0);
|
|
50
50
|
const variantCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ?? 0), 0);
|
|
51
51
|
const emptyStoryCount = ctx.storyFiles.length - storyCount;
|
|
52
|
-
const
|
|
52
|
+
const buildViteConfig = mergeViteConfig(await getViteConfigWithPlugins(false, ctx), {
|
|
53
53
|
mode: 'development',
|
|
54
54
|
build: {
|
|
55
55
|
rollupOptions: {
|
|
@@ -70,7 +70,34 @@ export async function build(ctx) {
|
|
|
70
70
|
cssCodeSplit: false,
|
|
71
71
|
minify: false,
|
|
72
72
|
},
|
|
73
|
-
})
|
|
73
|
+
});
|
|
74
|
+
// For @vite/plugin-vue: Always put our vite server
|
|
75
|
+
// Disable template inlining
|
|
76
|
+
// (so that we no longer need defineExpose)
|
|
77
|
+
// Nuxt: replaces the Nuxt vite dev server
|
|
78
|
+
buildViteConfig.plugins.push({
|
|
79
|
+
name: 'histoire-vue-plugin-override',
|
|
80
|
+
config(config) {
|
|
81
|
+
const vuePlugin = config.plugins.find((p) => p.name === 'vite:vue');
|
|
82
|
+
if (vuePlugin) {
|
|
83
|
+
const original = vuePlugin.configureServer.bind(vuePlugin);
|
|
84
|
+
vuePlugin.configureServer = () => {
|
|
85
|
+
original({
|
|
86
|
+
...server,
|
|
87
|
+
config: {
|
|
88
|
+
...server.config,
|
|
89
|
+
server: {
|
|
90
|
+
...server.config.server,
|
|
91
|
+
hmr: false,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
vuePlugin.configureServer();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const results = await viteBuild(buildViteConfig);
|
|
74
101
|
const result = Array.isArray(results) ? results[0] : results;
|
|
75
102
|
const styleOutput = result.output.find(o => o.name === 'style.css' && o.type === 'asset');
|
|
76
103
|
// Preload
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"histoire": "./bin.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@histoire/controls": "^0.
|
|
36
|
+
"@histoire/controls": "^0.7.0",
|
|
37
37
|
"@iconify/vue": "^3.2.1",
|
|
38
38
|
"@types/markdown-it": "^12.2.3",
|
|
39
39
|
"@vueuse/core": "^8.2.5",
|
package/src/node/build.ts
CHANGED
|
@@ -65,7 +65,7 @@ export async function build (ctx: Context) {
|
|
|
65
65
|
const variantCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ?? 0), 0)
|
|
66
66
|
const emptyStoryCount = ctx.storyFiles.length - storyCount
|
|
67
67
|
|
|
68
|
-
const
|
|
68
|
+
const buildViteConfig = mergeViteConfig(await getViteConfigWithPlugins(false, ctx), {
|
|
69
69
|
mode: 'development',
|
|
70
70
|
build: {
|
|
71
71
|
rollupOptions: {
|
|
@@ -86,7 +86,36 @@ export async function build (ctx: Context) {
|
|
|
86
86
|
cssCodeSplit: false,
|
|
87
87
|
minify: false,
|
|
88
88
|
},
|
|
89
|
-
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
// For @vite/plugin-vue: Always put our vite server
|
|
92
|
+
// Disable template inlining
|
|
93
|
+
// (so that we no longer need defineExpose)
|
|
94
|
+
// Nuxt: replaces the Nuxt vite dev server
|
|
95
|
+
buildViteConfig.plugins.push({
|
|
96
|
+
name: 'histoire-vue-plugin-override',
|
|
97
|
+
config (config) {
|
|
98
|
+
const vuePlugin = config.plugins.find((p: any) => p.name === 'vite:vue')
|
|
99
|
+
if (vuePlugin) {
|
|
100
|
+
const original = vuePlugin.configureServer.bind(vuePlugin)
|
|
101
|
+
vuePlugin.configureServer = () => {
|
|
102
|
+
original({
|
|
103
|
+
...server,
|
|
104
|
+
config: {
|
|
105
|
+
...server.config,
|
|
106
|
+
server: {
|
|
107
|
+
...server.config.server,
|
|
108
|
+
hmr: false,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
vuePlugin.configureServer()
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const results = await viteBuild(buildViteConfig)
|
|
90
119
|
const result = Array.isArray(results) ? results[0] : results as RollupOutput
|
|
91
120
|
|
|
92
121
|
const styleOutput = result.output.find(o => o.name === 'style.css' && o.type === 'asset')
|