histoire 1.0.0-alpha.2 → 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/server.d.ts +1 -0
- package/dist/node/server.d.ts.map +1 -1
- package/dist/node/server.js +7 -2
- package/package.json +8 -8
- 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/server.ts +9 -2
- package/src/node/vite.ts +1 -1
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,
|
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/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",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"sade": "^1.8.1",
|
|
65
65
|
"shiki": "^3.0.0",
|
|
66
66
|
"sirv": "^3.0.0",
|
|
67
|
-
"vite-node": "
|
|
68
|
-
"@histoire/app": "^1.0.0-alpha.
|
|
69
|
-
"@histoire/
|
|
70
|
-
"@histoire/vendors": "^1.0.0-alpha.
|
|
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/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(
|