histoire 0.3.3 → 0.4.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/bundled/BaseEmpty.js +13 -0
- package/dist/bundled/HomeView.js +23 -0
- package/dist/bundled/MobileOverlay.js +303 -0
- package/dist/bundled/SearchPane.js +504 -0
- package/dist/bundled/StoryView.js +2330 -0
- package/dist/bundled/api.js +32 -0
- package/dist/bundled/config.js +4 -0
- package/dist/bundled/const.js +5 -0
- package/dist/bundled/dark.js +4 -0
- package/dist/bundled/events.js +29 -0
- package/dist/bundled/global-components.js +203 -0
- package/dist/bundled/index.js +7 -0
- package/dist/bundled/index2.js +762 -0
- package/dist/bundled/reactivity.js +96 -0
- package/dist/bundled/sandbox.js +97 -0
- package/dist/bundled/search-docs-data.js +7 -0
- package/dist/bundled/story.js +59 -0
- package/dist/bundled/style.css +102 -0
- package/dist/client/app/App.vue +2 -2
- package/dist/client/app/api.d.ts +1 -0
- package/dist/client/app/api.js +1 -0
- package/dist/client/app/codegen/vue3.js +1 -2
- package/dist/client/app/components/HomeView.vue +1 -1
- package/dist/client/app/components/app/AppLogo.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +0 -1
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/dist/client/app/components/exposed/Story.vue +1 -1
- package/dist/client/app/components/search/SearchItem.vue +1 -1
- package/dist/client/app/components/search/SearchPane.vue +96 -21
- package/dist/client/app/components/search/search-docs-data.d.ts +3 -0
- package/dist/client/app/components/search/{search-data.js → search-docs-data.js} +1 -1
- package/dist/client/app/components/search/search-title-data.d.ts +3 -0
- package/dist/client/app/components/search/search-title-data.js +7 -0
- package/dist/client/app/components/search/{search-data.d.ts → types.d.ts} +0 -2
- package/dist/client/app/components/search/types.js +1 -0
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/dist/client/app/components/tree/StoryListItem.vue +1 -1
- package/dist/client/app/index.d.ts +1 -1
- package/dist/client/app/index.js +21 -18
- package/dist/client/app/sandbox.d.ts +1 -1
- package/dist/client/app/sandbox.js +0 -1
- package/dist/client/app/util/events.d.ts +1 -1
- package/dist/client/app/util/events.js +2 -2
- package/dist/client/bundle-index.js +5 -0
- package/dist/client/bundle-main.js +5 -0
- package/dist/client/bundle-sandbox.js +3 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/server/vue3/run.js +8 -0
- package/dist/node/alias.js +1 -1
- package/dist/node/build.js +4 -4
- package/dist/node/builtin-plugins/tailwind-tokens.js +1 -1
- package/dist/node/search.d.ts +9 -1
- package/dist/node/search.js +69 -32
- package/dist/node/server.js +2 -2
- package/dist/node/types.d.ts +1 -0
- package/dist/node/vite.d.ts +4 -2
- package/dist/node/vite.js +22 -29
- package/package.json +9 -9
- package/src/client/app/App.vue +2 -2
- package/src/client/app/api.ts +1 -0
- package/src/client/app/codegen/vue3.ts +1 -2
- package/src/client/app/components/HomeView.vue +1 -1
- package/src/client/app/components/app/AppLogo.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +0 -1
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/src/client/app/components/exposed/Story.vue +1 -1
- package/src/client/app/components/search/SearchItem.vue +1 -1
- package/src/client/app/components/search/SearchPane.vue +96 -21
- package/src/client/app/components/search/{search-data.ts → search-docs-data.ts} +2 -6
- package/src/client/app/components/search/search-title-data.ts +10 -0
- package/src/client/app/components/search/types.ts +4 -0
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/src/client/app/components/tree/StoryListItem.vue +1 -1
- package/src/client/app/index.ts +23 -19
- package/src/client/app/sandbox.ts +0 -1
- package/src/client/app/util/events.ts +2 -2
- package/src/client/bundle-index.js +5 -0
- package/src/client/bundle-main.js +5 -0
- package/src/client/bundle-sandbox.js +3 -0
- package/src/client/index.ts +1 -1
- package/src/client/server/vue3/run.ts +11 -0
- package/src/node/alias.ts +1 -1
- package/src/node/build.ts +4 -4
- package/src/node/builtin-plugins/tailwind-tokens.ts +1 -1
- package/src/node/search.ts +77 -33
- package/src/node/server.ts +2 -2
- package/src/node/types.ts +1 -0
- package/src/node/vite.ts +22 -30
- package/vite.config.ts +46 -0
package/src/node/server.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServer as createViteServer } from 'vite'
|
|
2
2
|
import { Context } from './context.js'
|
|
3
|
-
import { createVitePlugins,
|
|
3
|
+
import { createVitePlugins, RESOLVED_SEARCH_TITLE_DATA_ID, RESOLVED_STORIES_ID } from './vite.js'
|
|
4
4
|
import { notifyStoryChange, onStoryChange, watchStories } from './stories.js'
|
|
5
5
|
import { useCollectStories } from './collect/index.js'
|
|
6
6
|
import type { StoryFile } from './types.js'
|
|
@@ -112,7 +112,7 @@ export async function createServer (ctx: Context, port: number) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
invalidateModule(RESOLVED_STORIES_ID)
|
|
115
|
-
invalidateModule(
|
|
115
|
+
invalidateModule(RESOLVED_SEARCH_TITLE_DATA_ID)
|
|
116
116
|
})
|
|
117
117
|
|
|
118
118
|
async function close () {
|
package/src/node/types.ts
CHANGED
package/src/node/vite.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { notifyStoryChange } from './stories.js'
|
|
|
8
8
|
import { makeTree } from './tree.js'
|
|
9
9
|
import { parseColor } from './colors.js'
|
|
10
10
|
import { createMarkdownRenderer } from './markdown.js'
|
|
11
|
-
import {
|
|
11
|
+
import { getSearchDataJS, generateDocSearchData, generateTitleSearchData } from './search.js'
|
|
12
12
|
|
|
13
13
|
const require = createRequire(import.meta.url)
|
|
14
14
|
|
|
@@ -20,19 +20,16 @@ export const CONFIG_ID = '$histoire-config'
|
|
|
20
20
|
export const RESOLVED_CONFIG_ID = `/${CONFIG_ID}-resolved`
|
|
21
21
|
export const THEME_ID = '$histoire-theme'
|
|
22
22
|
export const RESOLVED_THEME_ID = `/${THEME_ID}-resolved.css`
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
23
|
+
export const SEARCH_TITLE_DATA_ID = '$histoire-search-title-data'
|
|
24
|
+
export const RESOLVED_SEARCH_TITLE_DATA_ID = `/${SEARCH_TITLE_DATA_ID}-resolved`
|
|
25
|
+
export const SEARCH_DOCS_DATA_ID = '$histoire-search-docs-data'
|
|
26
|
+
export const RESOLVED_SEARCH_DOCS_DATA_ID = `/${SEARCH_DOCS_DATA_ID}-resolved`
|
|
25
27
|
|
|
26
28
|
export async function createVitePlugins (ctx: Context): Promise<VitePlugin[]> {
|
|
27
29
|
const viteConfig = await resolveViteConfig({}, ctx.mode === 'dev' ? 'serve' : 'build')
|
|
28
|
-
const hasVuePlugin = viteConfig.plugins.find(p => p.name === 'vite:vue')
|
|
29
30
|
|
|
30
31
|
const plugins: VitePlugin[] = []
|
|
31
32
|
|
|
32
|
-
if (!hasVuePlugin) {
|
|
33
|
-
plugins.push((await import('@vitejs/plugin-vue')).default())
|
|
34
|
-
}
|
|
35
|
-
|
|
36
33
|
if (ctx.config.vite) {
|
|
37
34
|
plugins.push({
|
|
38
35
|
name: 'histoire-vite-config-override',
|
|
@@ -51,14 +48,13 @@ export async function createVitePlugins (ctx: Context): Promise<VitePlugin[]> {
|
|
|
51
48
|
// force include vue to avoid duplicated copies when linked + optimized
|
|
52
49
|
include: [
|
|
53
50
|
'vue',
|
|
54
|
-
dirname(require.resolve('@vue/runtime-core/package.json')),
|
|
55
51
|
dirname(require.resolve('shiki/package.json')),
|
|
56
52
|
dirname(require.resolve('vscode-textmate/package.json')),
|
|
57
53
|
dirname(require.resolve('vscode-oniguruma/package.json')),
|
|
58
54
|
dirname(require.resolve('case/package.json')),
|
|
59
55
|
],
|
|
60
56
|
exclude: [
|
|
61
|
-
'histoire
|
|
57
|
+
'histoire',
|
|
62
58
|
],
|
|
63
59
|
},
|
|
64
60
|
server: {
|
|
@@ -92,8 +88,11 @@ export async function createVitePlugins (ctx: Context): Promise<VitePlugin[]> {
|
|
|
92
88
|
if (id.startsWith(THEME_ID)) {
|
|
93
89
|
return RESOLVED_THEME_ID
|
|
94
90
|
}
|
|
95
|
-
if (id.startsWith(
|
|
96
|
-
return
|
|
91
|
+
if (id.startsWith(SEARCH_TITLE_DATA_ID)) {
|
|
92
|
+
return RESOLVED_SEARCH_TITLE_DATA_ID
|
|
93
|
+
}
|
|
94
|
+
if (id.startsWith(SEARCH_DOCS_DATA_ID)) {
|
|
95
|
+
return RESOLVED_SEARCH_DOCS_DATA_ID
|
|
97
96
|
}
|
|
98
97
|
},
|
|
99
98
|
|
|
@@ -104,7 +103,10 @@ export async function createVitePlugins (ctx: Context): Promise<VitePlugin[]> {
|
|
|
104
103
|
return {
|
|
105
104
|
id: file.id,
|
|
106
105
|
path: file.treePath,
|
|
107
|
-
story:
|
|
106
|
+
story: {
|
|
107
|
+
...file.story,
|
|
108
|
+
docsText: undefined,
|
|
109
|
+
},
|
|
108
110
|
framework: 'vue3',
|
|
109
111
|
index,
|
|
110
112
|
}
|
|
@@ -152,21 +154,11 @@ if (import.meta.hot) {
|
|
|
152
154
|
css += '}'
|
|
153
155
|
return css
|
|
154
156
|
}
|
|
155
|
-
if (id ===
|
|
156
|
-
return
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
if (import.meta.hot) {
|
|
162
|
-
import.meta.hot.accept(newModule => {
|
|
163
|
-
searchData = newModule.searchData
|
|
164
|
-
handlers.forEach(h => {
|
|
165
|
-
h(newModule.searchData)
|
|
166
|
-
newModule.onUpdate(h)
|
|
167
|
-
})
|
|
168
|
-
})
|
|
169
|
-
}`
|
|
157
|
+
if (id === RESOLVED_SEARCH_TITLE_DATA_ID) {
|
|
158
|
+
return getSearchDataJS(await generateTitleSearchData(ctx))
|
|
159
|
+
}
|
|
160
|
+
if (id === RESOLVED_SEARCH_DOCS_DATA_ID) {
|
|
161
|
+
return getSearchDataJS(await generateDocSearchData(ctx))
|
|
170
162
|
}
|
|
171
163
|
},
|
|
172
164
|
|
|
@@ -201,7 +193,7 @@ if (import.meta.hot) {
|
|
|
201
193
|
}
|
|
202
194
|
}
|
|
203
195
|
</script>
|
|
204
|
-
<script type="module" src="/@fs/${APP_PATH}/sandbox.js"></script>
|
|
196
|
+
<script type="module" src="/@fs/${APP_PATH}/bundle-sandbox.js"></script>
|
|
205
197
|
</body>
|
|
206
198
|
</html>`
|
|
207
199
|
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
@@ -232,7 +224,7 @@ if (import.meta.hot) {
|
|
|
232
224
|
</head>
|
|
233
225
|
<body>
|
|
234
226
|
<div id="app"></div>
|
|
235
|
-
<script type="module" src="/@fs/${APP_PATH}/
|
|
227
|
+
<script type="module" src="/@fs/${APP_PATH}/bundle-main.js"></script>
|
|
236
228
|
</body>
|
|
237
229
|
</html>`
|
|
238
230
|
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
vue(),
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
build: {
|
|
10
|
+
emptyOutDir: false,
|
|
11
|
+
outDir: 'dist/bundled',
|
|
12
|
+
lib: {
|
|
13
|
+
entry: '',
|
|
14
|
+
formats: ['es'],
|
|
15
|
+
},
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
external: [
|
|
18
|
+
/\$histoire/,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
+
...Object.keys(require('./package.json').dependencies),
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
input: [
|
|
24
|
+
'src/client/app/api.ts',
|
|
25
|
+
'src/client/app/index.ts',
|
|
26
|
+
'src/client/app/sandbox.ts',
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
output: {
|
|
30
|
+
// manualChunks (id) {
|
|
31
|
+
// if (id.includes('node_modules')) {
|
|
32
|
+
// return 'vendor'
|
|
33
|
+
// }
|
|
34
|
+
// },
|
|
35
|
+
entryFileNames: '[name].js',
|
|
36
|
+
chunkFileNames: '[name].js',
|
|
37
|
+
assetFileNames: '[name][extname]',
|
|
38
|
+
hoistTransitiveImports: false,
|
|
39
|
+
},
|
|
40
|
+
treeshake: false,
|
|
41
|
+
preserveEntrySignatures: 'strict',
|
|
42
|
+
},
|
|
43
|
+
cssCodeSplit: false,
|
|
44
|
+
minify: false,
|
|
45
|
+
},
|
|
46
|
+
})
|