histoire 1.0.0-alpha.4 → 1.0.0-alpha.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/builtin-plugins/tailwind-tokens.js +4 -3
- package/dist/node/collect/index.d.ts.map +1 -1
- package/dist/node/collect/index.js +3 -1
- package/dist/node/server.js +1 -1
- package/dist/node/stories.d.ts.map +1 -1
- package/dist/node/stories.js +15 -4
- package/package.json +5 -5
- package/src/node/builtin-plugins/tailwind-tokens.ts +4 -3
- package/src/node/collect/index.ts +3 -1
- package/src/node/server.ts +1 -1
- package/src/node/stories.ts +18 -4
|
@@ -72,9 +72,10 @@ export function tailwindTokens(options = {}) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
function storyTemplate(tailwindConfig) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
return `
|
|
76
|
+
import 'histoire-style'
|
|
77
|
+
import './style.css'
|
|
78
|
+
import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
78
79
|
import {
|
|
79
80
|
HstColorShades,
|
|
80
81
|
HstTokenList,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/collect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/collect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAa5C,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,aAAa,CAAA;IACrB,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,GAAG,EAAE,OAAO;;kCA0EpC,eAAe;;EA+D3D"}
|
|
@@ -2,9 +2,10 @@ import { cpus } from 'node:os';
|
|
|
2
2
|
import { MessageChannel } from 'node:worker_threads';
|
|
3
3
|
import Tinypool from '@akryum/tinypool';
|
|
4
4
|
import { createBirpc } from 'birpc';
|
|
5
|
-
import { relative } from 'pathe';
|
|
5
|
+
import path, { relative } from 'pathe';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
import { ViteNodeServer } from 'vite-node/server';
|
|
8
|
+
import { TEMP_PATH } from '../alias.js';
|
|
8
9
|
import { createPath } from '../tree.js';
|
|
9
10
|
import { slash } from '../util/fs.js';
|
|
10
11
|
export function useCollectStories(options, ctx) {
|
|
@@ -21,6 +22,7 @@ export function useCollectStories(options, ctx) {
|
|
|
21
22
|
// @TODO temporary fix for https://github.com/histoire-dev/histoire/issues/409
|
|
22
23
|
/vite\w*\/dist\/client\/(client|env).mjs/,
|
|
23
24
|
...ctx.config.viteNodeInlineDeps ?? [],
|
|
25
|
+
new RegExp(path.resolve(TEMP_PATH, 'plugins')),
|
|
24
26
|
],
|
|
25
27
|
fallbackCJS: true,
|
|
26
28
|
},
|
package/dist/node/server.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function createServer(ctx, options = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const server = await createViteServer(mergeViteConfig(viteConfig, {
|
|
24
|
-
optimizeDeps: { include: viteConfig.optimizeDeps?.include ?? [], noDiscovery:
|
|
24
|
+
optimizeDeps: { include: viteConfig.optimizeDeps?.include ?? [], noDiscovery: collecting },
|
|
25
25
|
}));
|
|
26
26
|
await server.pluginContainer.buildStart({});
|
|
27
27
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/node/stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAO3C,KAAK,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAA;AAG7D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,QAExD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,eAAe,QAIvD;AAED,KAAK,sBAAsB,GAAG,MAAM,OAAO,CAAA;AAG3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,QAEhE;AAED,wBAAgB,qBAAqB,SAIpC;AAID,wBAAsB,YAAY,CAAC,UAAU,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/node/stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAO3C,KAAK,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAA;AAG7D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,QAExD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,eAAe,QAIvD;AAED,KAAK,sBAAsB,GAAG,MAAM,OAAO,CAAA;AAG3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,QAEhE;AAED,wBAAgB,qBAAqB,SAIpC;AAID,wBAAsB,YAAY,CAAC,UAAU,EAAE,OAAO,yCA0CrD;AAMD,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,mBA0C5E;AAED,wBAAgB,WAAW,CAAC,gBAAgB,EAAE,MAAM,QAInD;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,OAAO,iBAWvD"}
|
package/dist/node/stories.js
CHANGED
|
@@ -32,16 +32,27 @@ export function notifyStoryListChange() {
|
|
|
32
32
|
let context;
|
|
33
33
|
export async function watchStories(newContext) {
|
|
34
34
|
context = newContext;
|
|
35
|
-
const
|
|
35
|
+
const baseWatchPaths = Array.from(new Set(context.config.storyMatch.map((pattern) => {
|
|
36
|
+
const segments = pattern.split('/');
|
|
37
|
+
return segments.slice(0, segments.findIndex(segment => segment.includes('*'))).join('/') || '.';
|
|
38
|
+
})));
|
|
39
|
+
const resolvedStoryIgnored = context.config.storyIgnored.map((pattern) => {
|
|
40
|
+
return resolve(context.root, pattern);
|
|
41
|
+
});
|
|
42
|
+
const resolveStoryMatch = context.config.storyMatch.map((pattern) => {
|
|
43
|
+
return resolve(context.root, pattern);
|
|
44
|
+
});
|
|
45
|
+
const watcher = chokidar.watch(baseWatchPaths, {
|
|
36
46
|
cwd: context.root,
|
|
37
47
|
ignored: (path, stats) => {
|
|
38
|
-
if (
|
|
48
|
+
if (resolvedStoryIgnored.some(pattern => micromatch.isMatch(path, pattern))) {
|
|
39
49
|
return true;
|
|
40
50
|
}
|
|
41
|
-
if (
|
|
51
|
+
if (resolveStoryMatch.some(pattern => micromatch.isMatch(path, pattern))) {
|
|
42
52
|
return false;
|
|
43
53
|
}
|
|
44
|
-
|
|
54
|
+
// Allow directories to be traversed, only ignore files that don't match
|
|
55
|
+
return stats?.isFile() ?? false;
|
|
45
56
|
},
|
|
46
57
|
});
|
|
47
58
|
watcher
|
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.5",
|
|
5
5
|
"description": "A fast story book powered by Vite",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Guillaume Chau"
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"shiki": "^3.0.0",
|
|
66
66
|
"sirv": "^3.0.0",
|
|
67
67
|
"vite-node": "3.2.4",
|
|
68
|
-
"@histoire/app": "^1.0.0-alpha.
|
|
69
|
-
"@histoire/
|
|
70
|
-
"@histoire/vendors": "^1.0.0-alpha.
|
|
71
|
-
"@histoire/
|
|
68
|
+
"@histoire/app": "^1.0.0-alpha.5",
|
|
69
|
+
"@histoire/shared": "^1.0.0-alpha.5",
|
|
70
|
+
"@histoire/vendors": "^1.0.0-alpha.5",
|
|
71
|
+
"@histoire/controls": "^1.0.0-alpha.5"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -84,9 +84,10 @@ export function tailwindTokens(options: TailwindTokensOptions = {}): Plugin {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function storyTemplate(tailwindConfig: any) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
return `
|
|
88
|
+
import 'histoire-style'
|
|
89
|
+
import './style.css'
|
|
90
|
+
import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')}
|
|
90
91
|
import {
|
|
91
92
|
HstColorShades,
|
|
92
93
|
HstTokenList,
|
|
@@ -7,9 +7,10 @@ import { cpus } from 'node:os'
|
|
|
7
7
|
import { MessageChannel } from 'node:worker_threads'
|
|
8
8
|
import Tinypool from '@akryum/tinypool'
|
|
9
9
|
import { createBirpc } from 'birpc'
|
|
10
|
-
import { relative } from 'pathe'
|
|
10
|
+
import path, { relative } from 'pathe'
|
|
11
11
|
import pc from 'picocolors'
|
|
12
12
|
import { ViteNodeServer } from 'vite-node/server'
|
|
13
|
+
import { TEMP_PATH } from '../alias.js'
|
|
13
14
|
import { createPath } from '../tree.js'
|
|
14
15
|
import { slash } from '../util/fs.js'
|
|
15
16
|
|
|
@@ -34,6 +35,7 @@ export function useCollectStories(options: UseCollectStoriesOptions, ctx: Contex
|
|
|
34
35
|
// @TODO temporary fix for https://github.com/histoire-dev/histoire/issues/409
|
|
35
36
|
/vite\w*\/dist\/client\/(client|env).mjs/,
|
|
36
37
|
...ctx.config.viteNodeInlineDeps ?? [],
|
|
38
|
+
new RegExp(path.resolve(TEMP_PATH, 'plugins')),
|
|
37
39
|
],
|
|
38
40
|
fallbackCJS: true,
|
|
39
41
|
},
|
package/src/node/server.ts
CHANGED
|
@@ -34,7 +34,7 @@ export async function createServer(ctx: Context, options: CreateServerOptions =
|
|
|
34
34
|
|
|
35
35
|
const server = await createViteServer(
|
|
36
36
|
mergeViteConfig(viteConfig, {
|
|
37
|
-
optimizeDeps: { include: viteConfig.optimizeDeps?.include ?? [], noDiscovery:
|
|
37
|
+
optimizeDeps: { include: viteConfig.optimizeDeps?.include ?? [], noDiscovery: collecting },
|
|
38
38
|
}),
|
|
39
39
|
)
|
|
40
40
|
await server.pluginContainer.buildStart({})
|
package/src/node/stories.ts
CHANGED
|
@@ -45,17 +45,31 @@ let context: Context
|
|
|
45
45
|
export async function watchStories(newContext: Context) {
|
|
46
46
|
context = newContext
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const baseWatchPaths = Array.from(new Set(context.config.storyMatch.map((pattern) => {
|
|
49
|
+
const segments = pattern.split('/')
|
|
50
|
+
return segments.slice(0, segments.findIndex(segment => segment.includes('*'))).join('/') || '.'
|
|
51
|
+
})))
|
|
52
|
+
|
|
53
|
+
const resolvedStoryIgnored = context.config.storyIgnored.map((pattern) => {
|
|
54
|
+
return resolve(context.root, pattern)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const resolveStoryMatch = context.config.storyMatch.map((pattern) => {
|
|
58
|
+
return resolve(context.root, pattern)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const watcher = chokidar.watch(baseWatchPaths, {
|
|
49
62
|
cwd: context.root,
|
|
50
63
|
ignored: (path, stats) => {
|
|
51
|
-
if (
|
|
64
|
+
if (resolvedStoryIgnored.some(pattern => micromatch.isMatch(path, pattern))) {
|
|
52
65
|
return true
|
|
53
66
|
}
|
|
54
|
-
if (
|
|
67
|
+
if (resolveStoryMatch.some(pattern => micromatch.isMatch(path, pattern))) {
|
|
55
68
|
return false
|
|
56
69
|
}
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
// Allow directories to be traversed, only ignore files that don't match
|
|
72
|
+
return stats?.isFile() ?? false
|
|
59
73
|
},
|
|
60
74
|
})
|
|
61
75
|
|