histoire 1.0.0-alpha.1 → 1.0.0-alpha.3
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/bin.js +1 -0
- package/dist/node/build.d.ts.map +1 -1
- package/dist/node/build.js +1 -0
- package/dist/node/builtin-plugins/tailwind-tokens.js +3 -3
- package/dist/node/commands/dev.d.ts +1 -0
- package/dist/node/commands/dev.d.ts.map +1 -1
- package/dist/node/commands/dev.js +1 -0
- package/dist/node/dom/env.d.ts.map +1 -1
- package/dist/node/dom/env.js +9 -0
- package/dist/node/markdown.d.ts.map +1 -1
- package/dist/node/markdown.js +5 -6
- package/dist/node/server.d.ts +1 -0
- package/dist/node/server.d.ts.map +1 -1
- package/dist/node/server.js +7 -2
- package/dist/node/vite.js +1 -1
- package/package.json +9 -9
- package/src/node/bin.ts +1 -0
- package/src/node/build.ts +1 -0
- package/src/node/builtin-plugins/tailwind-tokens.ts +3 -3
- package/src/node/commands/dev.ts +2 -0
- package/src/node/dom/env.ts +10 -0
- package/src/node/markdown.ts +5 -6
- package/src/node/server.ts +9 -2
- package/src/node/vite.ts +2 -2
package/dist/node/bin.js
CHANGED
|
@@ -13,6 +13,7 @@ program.command('dev')
|
|
|
13
13
|
.option('-p, --port <port>', 'Listening port of the server')
|
|
14
14
|
.option('-c, --config <file>', `[string] use specified config file`)
|
|
15
15
|
.option('--open', 'Open in your default browser')
|
|
16
|
+
.option('--host <host>', '[string] specify hostname')
|
|
16
17
|
.action(async (options) => {
|
|
17
18
|
const { devCommand } = await import('./commands/dev.js');
|
|
18
19
|
return devCommand(options);
|
package/dist/node/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/node/build.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AA+B3C,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/node/build.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AA+B3C,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,iBA8MvC"}
|
package/dist/node/build.js
CHANGED
|
@@ -72,9 +72,9 @@ export function tailwindTokens(options = {}) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
function storyTemplate(tailwindConfig) {
|
|
75
|
-
|
|
76
|
-
import './style.css'
|
|
77
|
-
import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
75
|
+
// import 'histoire-style'
|
|
76
|
+
// import './style.css'
|
|
77
|
+
return `import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
78
78
|
import {
|
|
79
79
|
HstColorShades,
|
|
80
80
|
HstTokenList,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/node/commands/dev.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/node/commands/dev.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,iBAoDnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/node/dom/env.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY;;;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/node/dom/env.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY;;;EA0C3B"}
|
package/dist/node/dom/env.js
CHANGED
|
@@ -21,6 +21,15 @@ export function createDomEnv() {
|
|
|
21
21
|
observe(_target, _options) { }
|
|
22
22
|
unobserve(_target) { }
|
|
23
23
|
};
|
|
24
|
+
window.IntersectionObserver = window.IntersectionObserver || class IntersectionObserver {
|
|
25
|
+
root;
|
|
26
|
+
rootMargin;
|
|
27
|
+
thresholds;
|
|
28
|
+
disconnect() { }
|
|
29
|
+
observe = (_target) => void { /* noop */};
|
|
30
|
+
unobserve(_target) { }
|
|
31
|
+
takeRecords() { return []; }
|
|
32
|
+
};
|
|
24
33
|
return {
|
|
25
34
|
window,
|
|
26
35
|
destroy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/node/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAK3C,OAAO,UAAU,MAAM,aAAa,CAAA;AAapC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,OAAO,QAE1D;AAQD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/node/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAK3C,OAAO,UAAU,MAAM,aAAa,CAAA;AAapC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,OAAO,QAE1D;AAQD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,uBAsExD;AAaD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,8BAqBvD;AAED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,OAAO;;GAgI5D;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
|
package/dist/node/markdown.js
CHANGED
|
@@ -9,7 +9,7 @@ import { full as emoji } from 'markdown-it-emoji';
|
|
|
9
9
|
import micromatch from 'micromatch';
|
|
10
10
|
import path from 'pathe';
|
|
11
11
|
import pc from 'picocolors';
|
|
12
|
-
import {
|
|
12
|
+
import { bundledLanguages, createHighlighter } from 'shiki';
|
|
13
13
|
import { addStory, notifyStoryChange, removeStory } from './stories.js';
|
|
14
14
|
import { slugify } from './util/slugify.js';
|
|
15
15
|
const onMarkdownListChangeHandlers = [];
|
|
@@ -22,13 +22,12 @@ function notifyMarkdownListChange() {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export async function createMarkdownRenderer(ctx) {
|
|
25
|
-
const highlighter = await
|
|
26
|
-
|
|
25
|
+
const highlighter = await createHighlighter({
|
|
26
|
+
themes: ['github-dark'],
|
|
27
|
+
langs: Object.keys(bundledLanguages), // not ideal but markdown-it does not provide async highlight
|
|
27
28
|
});
|
|
28
29
|
const md = new MarkdownIt({
|
|
29
|
-
highlight: (code, lang) => `<div class="htw-relative htw-not-prose __histoire-code"><div class="htw-absolute htw-top-0 htw-right-0 htw-text-xs htw-text-white/40">${lang}</div>${highlighter.codeToHtml(code, {
|
|
30
|
-
lang,
|
|
31
|
-
})}</div>`,
|
|
30
|
+
highlight: (code, lang) => `<div class="htw-relative htw-not-prose __histoire-code"><div class="htw-absolute htw-top-0 htw-right-0 htw-text-xs htw-text-white/40">${lang}</div>${highlighter.codeToHtml(code, { theme: 'github-dark', lang })}</div>`,
|
|
32
31
|
linkify: true,
|
|
33
32
|
html: true,
|
|
34
33
|
breaks: false,
|
package/dist/node/server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Context } from './context.js';
|
|
|
2
2
|
export interface CreateServerOptions {
|
|
3
3
|
port?: number;
|
|
4
4
|
open?: boolean;
|
|
5
|
+
host?: string | boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function createServer(ctx: Context, options?: CreateServerOptions): Promise<{
|
|
7
8
|
server: import("vite").ViteDevServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/node/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAa3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/node/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAa3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACxB;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB;;;;GAsNjF"}
|
package/dist/node/server.js
CHANGED
|
@@ -12,8 +12,13 @@ import { getViteConfigWithPlugins } from './vite.js';
|
|
|
12
12
|
export async function createServer(ctx, options = {}) {
|
|
13
13
|
const getViteServer = async (collecting) => {
|
|
14
14
|
const { viteConfig, viteConfigFile } = await getViteConfigWithPlugins(collecting, ctx);
|
|
15
|
-
if (!collecting
|
|
16
|
-
|
|
15
|
+
if (!collecting) {
|
|
16
|
+
if (options.open) {
|
|
17
|
+
viteConfig.server.open = true;
|
|
18
|
+
}
|
|
19
|
+
if (options.host) {
|
|
20
|
+
viteConfig.server.host = options.host;
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
const server = await createViteServer(mergeViteConfig(viteConfig, {
|
|
19
24
|
optimizeDeps: { include: [], noDiscovery: true },
|
package/dist/node/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.3",
|
|
5
5
|
"description": "A fast story book powered by Vite",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Guillaume Chau"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"histoire": "./bin.mjs"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"vite": "^
|
|
40
|
+
"vite": "^7.0.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@akryum/tinypool": "^0.3.1",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"pathe": "^1.1.2",
|
|
63
63
|
"picocolors": "^1.1.1",
|
|
64
64
|
"sade": "^1.8.1",
|
|
65
|
-
"shiki
|
|
65
|
+
"shiki": "^3.0.0",
|
|
66
66
|
"sirv": "^3.0.0",
|
|
67
|
-
"vite-node": "
|
|
68
|
-
"@histoire/app": "^1.0.0-alpha.
|
|
69
|
-
"@histoire/controls": "^1.0.0-alpha.
|
|
70
|
-
"@histoire/
|
|
71
|
-
"@histoire/
|
|
67
|
+
"vite-node": "3.2.4",
|
|
68
|
+
"@histoire/app": "^1.0.0-alpha.3",
|
|
69
|
+
"@histoire/controls": "^1.0.0-alpha.3",
|
|
70
|
+
"@histoire/vendors": "^1.0.0-alpha.3",
|
|
71
|
+
"@histoire/shared": "^1.0.0-alpha.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"esbuild": "^0.24.0",
|
|
77
77
|
"rollup": "^4.28.0",
|
|
78
78
|
"typescript": "5.6.3",
|
|
79
|
-
"vite": "^
|
|
79
|
+
"vite": "^7.0.0",
|
|
80
80
|
"vitest": "0.34.6"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
package/src/node/bin.ts
CHANGED
|
@@ -18,6 +18,7 @@ program.command('dev')
|
|
|
18
18
|
.option('-p, --port <port>', 'Listening port of the server')
|
|
19
19
|
.option('-c, --config <file>', `[string] use specified config file`)
|
|
20
20
|
.option('--open', 'Open in your default browser')
|
|
21
|
+
.option('--host <host>', '[string] specify hostname')
|
|
21
22
|
.action(async (options) => {
|
|
22
23
|
const { devCommand } = await import('./commands/dev.js')
|
|
23
24
|
return devCommand(options)
|
package/src/node/build.ts
CHANGED
|
@@ -84,9 +84,9 @@ export function tailwindTokens(options: TailwindTokensOptions = {}): Plugin {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function storyTemplate(tailwindConfig: any) {
|
|
87
|
-
|
|
88
|
-
import './style.css'
|
|
89
|
-
import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
87
|
+
// import 'histoire-style'
|
|
88
|
+
// import './style.css'
|
|
89
|
+
return `import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
90
90
|
import {
|
|
91
91
|
HstColorShades,
|
|
92
92
|
HstTokenList,
|
package/src/node/commands/dev.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { createServer } from '../server.js'
|
|
|
8
8
|
export interface DevOptions {
|
|
9
9
|
port: number
|
|
10
10
|
open?: boolean
|
|
11
|
+
host?: string | boolean
|
|
11
12
|
config?: string
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -22,6 +23,7 @@ export async function devCommand(options: DevOptions) {
|
|
|
22
23
|
const { server, viteConfigFile, close } = await createServer(ctx, {
|
|
23
24
|
port: options.port,
|
|
24
25
|
open: options.open,
|
|
26
|
+
host: options.host,
|
|
25
27
|
})
|
|
26
28
|
server.printUrls()
|
|
27
29
|
|
package/src/node/dom/env.ts
CHANGED
|
@@ -32,6 +32,16 @@ export function createDomEnv() {
|
|
|
32
32
|
unobserve(_target: Element): void { /* noop */ }
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
window.IntersectionObserver = window.IntersectionObserver || class IntersectionObserver {
|
|
36
|
+
root: Element
|
|
37
|
+
rootMargin: string
|
|
38
|
+
thresholds: number[]
|
|
39
|
+
disconnect(): void { /* noop */ }
|
|
40
|
+
observe = (_target: Element) => void { /* noop */ }
|
|
41
|
+
unobserve(_target: Element): void { /* noop */ }
|
|
42
|
+
takeRecords(): IntersectionObserverEntry[] { return [] }
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
return {
|
|
36
46
|
window,
|
|
37
47
|
destroy,
|
package/src/node/markdown.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { full as emoji } from 'markdown-it-emoji'
|
|
|
12
12
|
import micromatch from 'micromatch'
|
|
13
13
|
import path from 'pathe'
|
|
14
14
|
import pc from 'picocolors'
|
|
15
|
-
import {
|
|
15
|
+
import { bundledLanguages, createHighlighter } from 'shiki'
|
|
16
16
|
import { addStory, notifyStoryChange, removeStory } from './stories.js'
|
|
17
17
|
import { slugify } from './util/slugify.js'
|
|
18
18
|
|
|
@@ -29,14 +29,13 @@ function notifyMarkdownListChange() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export async function createMarkdownRenderer(ctx: Context) {
|
|
32
|
-
const highlighter = await
|
|
33
|
-
|
|
32
|
+
const highlighter = await createHighlighter({
|
|
33
|
+
themes: ['github-dark'],
|
|
34
|
+
langs: Object.keys(bundledLanguages), // not ideal but markdown-it does not provide async highlight
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
const md = new MarkdownIt({
|
|
37
|
-
highlight: (code, lang) => `<div class="htw-relative htw-not-prose __histoire-code"><div class="htw-absolute htw-top-0 htw-right-0 htw-text-xs htw-text-white/40">${lang}</div>${highlighter.codeToHtml(code, {
|
|
38
|
-
lang,
|
|
39
|
-
})}</div>`,
|
|
38
|
+
highlight: (code, lang) => `<div class="htw-relative htw-not-prose __histoire-code"><div class="htw-absolute htw-top-0 htw-right-0 htw-text-xs htw-text-white/40">${lang}</div>${highlighter.codeToHtml(code, { theme: 'github-dark', lang })}</div>`,
|
|
40
39
|
linkify: true,
|
|
41
40
|
html: true,
|
|
42
41
|
breaks: false,
|
package/src/node/server.ts
CHANGED
|
@@ -15,14 +15,21 @@ import { getViteConfigWithPlugins } from './vite.js'
|
|
|
15
15
|
export interface CreateServerOptions {
|
|
16
16
|
port?: number
|
|
17
17
|
open?: boolean
|
|
18
|
+
host?: string | boolean
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export async function createServer(ctx: Context, options: CreateServerOptions = {}) {
|
|
21
22
|
const getViteServer = async (collecting: boolean) => {
|
|
22
23
|
const { viteConfig, viteConfigFile } = await getViteConfigWithPlugins(collecting, ctx)
|
|
23
24
|
|
|
24
|
-
if (!collecting
|
|
25
|
-
|
|
25
|
+
if (!collecting) {
|
|
26
|
+
if (options.open) {
|
|
27
|
+
viteConfig.server.open = true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (options.host) {
|
|
31
|
+
viteConfig.server.host = options.host
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
const server = await createViteServer(
|
package/src/node/vite.ts
CHANGED
|
@@ -107,7 +107,7 @@ export async function getViteConfigWithPlugins(isServer: boolean, ctx: Context):
|
|
|
107
107
|
],
|
|
108
108
|
include: optimizeDeps([
|
|
109
109
|
'flexsearch',
|
|
110
|
-
'shiki
|
|
110
|
+
'shiki',
|
|
111
111
|
// Shiki dependencies
|
|
112
112
|
'vscode-oniguruma',
|
|
113
113
|
'vscode-textmate',
|
|
@@ -154,7 +154,7 @@ export async function getViteConfigWithPlugins(isServer: boolean, ctx: Context):
|
|
|
154
154
|
},
|
|
155
155
|
|
|
156
156
|
options() {
|
|
157
|
-
this.meta.histoire = {
|
|
157
|
+
(this.meta as any).histoire = {
|
|
158
158
|
isCollecting: isServer,
|
|
159
159
|
}
|
|
160
160
|
},
|