histoire 0.9.2 → 0.9.5
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/vite.js +22 -1
- package/package.json +5 -5
- package/src/node/vite.ts +22 -1
package/dist/node/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
-
import { relative, resolve, join } from 'pathe';
|
|
2
|
+
import { relative, resolve, join, dirname } from 'pathe';
|
|
3
3
|
import { resolveConfig as resolveViteConfigInternal, mergeConfig as mergeViteConfig, loadConfigFromFile as loadViteConfigFromFile, } from 'vite';
|
|
4
4
|
import { lookup as lookupMime } from 'mrmime';
|
|
5
5
|
import { APP_PATH, TEMP_PATH } from './alias.js';
|
|
@@ -55,6 +55,18 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
|
55
55
|
const userViteConfig = await loadViteConfigFromFile({ command: ctx.mode === 'dev' ? 'serve' : 'build', mode: ctx.mode });
|
|
56
56
|
const inlineConfig = await mergeHistoireViteConfig(userViteConfig?.config ?? {}, ctx);
|
|
57
57
|
const plugins = [];
|
|
58
|
+
function optimizeDeps(deps) {
|
|
59
|
+
const result = [];
|
|
60
|
+
for (const dep of deps) {
|
|
61
|
+
try {
|
|
62
|
+
result.push(dirname(require.resolve(`${dep}/package.json`)));
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// Noop
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
58
70
|
plugins.push({
|
|
59
71
|
name: 'histoire-vite-plugin',
|
|
60
72
|
config() {
|
|
@@ -72,7 +84,16 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
|
72
84
|
entries: [
|
|
73
85
|
`${APP_PATH}/bundle-main.js`,
|
|
74
86
|
`${APP_PATH}/bundle-sandbox.js`,
|
|
87
|
+
// `${APP_PATH}/server/index.js`,
|
|
75
88
|
],
|
|
89
|
+
include: optimizeDeps([
|
|
90
|
+
'case',
|
|
91
|
+
'flexsearch',
|
|
92
|
+
'shiki',
|
|
93
|
+
// Shiki dependencies
|
|
94
|
+
'vscode-oniguruma',
|
|
95
|
+
'vscode-textmate',
|
|
96
|
+
]),
|
|
76
97
|
exclude: [
|
|
77
98
|
'histoire',
|
|
78
99
|
'@histoire',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"histoire": "./bin.mjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@histoire/app": "^0.9.
|
|
33
|
-
"@histoire/controls": "^0.9.
|
|
34
|
-
"@histoire/shared": "^0.9.
|
|
35
|
-
"@histoire/vendors": "^0.9.
|
|
32
|
+
"@histoire/app": "^0.9.5",
|
|
33
|
+
"@histoire/controls": "^0.9.5",
|
|
34
|
+
"@histoire/shared": "^0.9.5",
|
|
35
|
+
"@histoire/vendors": "^0.9.5",
|
|
36
36
|
"@types/flexsearch": "^0.7.3",
|
|
37
37
|
"@types/markdown-it": "^12.2.3",
|
|
38
38
|
"birpc": "^0.1.1",
|
package/src/node/vite.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'
|
|
2
|
-
import { relative, resolve, join } from 'pathe'
|
|
2
|
+
import { relative, resolve, join, dirname } from 'pathe'
|
|
3
3
|
import {
|
|
4
4
|
resolveConfig as resolveViteConfigInternal,
|
|
5
5
|
Plugin as VitePlugin,
|
|
@@ -72,6 +72,18 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
|
|
|
72
72
|
const inlineConfig = await mergeHistoireViteConfig(userViteConfig?.config ?? {}, ctx)
|
|
73
73
|
const plugins: VitePlugin[] = []
|
|
74
74
|
|
|
75
|
+
function optimizeDeps (deps: string[]): string[] {
|
|
76
|
+
const result = []
|
|
77
|
+
for (const dep of deps) {
|
|
78
|
+
try {
|
|
79
|
+
result.push(dirname(require.resolve(`${dep}/package.json`)))
|
|
80
|
+
} catch (e) {
|
|
81
|
+
// Noop
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return result
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
plugins.push({
|
|
76
88
|
name: 'histoire-vite-plugin',
|
|
77
89
|
|
|
@@ -90,7 +102,16 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
|
|
|
90
102
|
entries: [
|
|
91
103
|
`${APP_PATH}/bundle-main.js`,
|
|
92
104
|
`${APP_PATH}/bundle-sandbox.js`,
|
|
105
|
+
// `${APP_PATH}/server/index.js`,
|
|
93
106
|
],
|
|
107
|
+
include: optimizeDeps([
|
|
108
|
+
'case',
|
|
109
|
+
'flexsearch',
|
|
110
|
+
'shiki',
|
|
111
|
+
// Shiki dependencies
|
|
112
|
+
'vscode-oniguruma',
|
|
113
|
+
'vscode-textmate',
|
|
114
|
+
]),
|
|
94
115
|
exclude: [
|
|
95
116
|
'histoire',
|
|
96
117
|
'@histoire',
|