@dfosco/storyboard 0.5.0-alpha.0 → 0.5.0-alpha.1
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/package.json +1 -1
- package/src/core/cli/branch.js +1 -1
- package/src/core/cli/dev-helpers.test.js +6 -2
- package/src/core/devtools/devtools.test.js +6 -6
- package/src/internals/canvas/WebGLContextPool.test.jsx +9 -9
- package/src/internals/canvas/widgets/ComponentWidget.jsx +1 -1
- package/src/internals/vite/data-plugin.js +6 -1
package/package.json
CHANGED
package/src/core/cli/branch.js
CHANGED
|
@@ -29,7 +29,7 @@ import { resolve } from 'path'
|
|
|
29
29
|
import { repoRoot, worktreeDir, listWorktrees, getPort, detectWorktreeName } from '../worktree/port.js'
|
|
30
30
|
import { hasUncommittedChanges, localBranchExists } from './dev-helpers.js'
|
|
31
31
|
import { parseFlags } from './flags.js'
|
|
32
|
-
import { dim, green, bold
|
|
32
|
+
import { dim, green, bold } from './intro.js'
|
|
33
33
|
|
|
34
34
|
const flagSchema = {
|
|
35
35
|
worktree: { type: 'string', description: 'Target worktree/branch name (non-interactive)' },
|
|
@@ -20,8 +20,12 @@ describe('hasUncommittedChanges', () => {
|
|
|
20
20
|
|
|
21
21
|
describe('localBranchExists', () => {
|
|
22
22
|
it('returns true for a branch that exists', () => {
|
|
23
|
-
// The current branch must exist
|
|
24
|
-
|
|
23
|
+
// The current branch must exist — but in CI (detached HEAD) we fall back to 'main' or '0.5.0'
|
|
24
|
+
let branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: repoRoot, encoding: 'utf8' }).trim()
|
|
25
|
+
if (branch === 'HEAD') {
|
|
26
|
+
// Detached HEAD (e.g. CI checkout) — pick a branch we know exists
|
|
27
|
+
branch = localBranchExists('main', repoRoot) ? 'main' : '0.5.0'
|
|
28
|
+
}
|
|
25
29
|
expect(localBranchExists(branch, repoRoot)).toBe(true)
|
|
26
30
|
})
|
|
27
31
|
|
|
@@ -45,31 +45,31 @@ describe('mountDevTools', () => {
|
|
|
45
45
|
|
|
46
46
|
it('creates a wrapper element in the DOM', async () => {
|
|
47
47
|
await mountDevTools()
|
|
48
|
-
expect(document.getElementById('sb-
|
|
48
|
+
expect(document.getElementById('sb-core-ui')).not.toBeNull()
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
it('appends to document.body by default', async () => {
|
|
52
52
|
await mountDevTools()
|
|
53
|
-
expect(document.getElementById('sb-
|
|
53
|
+
expect(document.getElementById('sb-core-ui')).toBeInTheDocument()
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
it('accepts a custom container', async () => {
|
|
57
57
|
const container = document.createElement('div')
|
|
58
58
|
document.body.appendChild(container)
|
|
59
59
|
await mountDevTools({ container })
|
|
60
|
-
expect(container.querySelector('#sb-
|
|
60
|
+
expect(container.querySelector('#sb-core-ui')).not.toBeNull()
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
it('is idempotent — calling twice does not double-mount', async () => {
|
|
64
64
|
await mountDevTools()
|
|
65
65
|
await mountDevTools()
|
|
66
|
-
expect(document.querySelectorAll('#sb-
|
|
66
|
+
expect(document.querySelectorAll('#sb-core-ui').length).toBe(1)
|
|
67
67
|
})
|
|
68
68
|
|
|
69
69
|
it('unmountDevTools removes the wrapper', async () => {
|
|
70
70
|
await mountDevTools()
|
|
71
|
-
expect(document.getElementById('sb-
|
|
71
|
+
expect(document.getElementById('sb-core-ui')).not.toBeNull()
|
|
72
72
|
await unmountDevTools()
|
|
73
|
-
expect(document.getElementById('sb-
|
|
73
|
+
expect(document.getElementById('sb-core-ui')).toBeNull()
|
|
74
74
|
})
|
|
75
75
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, it, expect
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
2
|
import { render, act } from '@testing-library/react'
|
|
3
3
|
import { WebGLContextPoolProvider, useWebGLSlot, usePoolVisibilityUpdater, Priority } from './WebGLContextPool.jsx'
|
|
4
4
|
|
|
@@ -54,11 +54,11 @@ describe('WebGLContextPool', () => {
|
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
it('prioritizes PINNED widgets over OFFSCREEN', () => {
|
|
57
|
-
let
|
|
57
|
+
let slot3
|
|
58
58
|
render(
|
|
59
59
|
<WebGLContextPoolProvider maxLive={2}>
|
|
60
|
-
<TestWidget widgetId="t1" onSlot={(
|
|
61
|
-
<TestWidget widgetId="t2" onSlot={(
|
|
60
|
+
<TestWidget widgetId="t1" onSlot={() => {}} />
|
|
61
|
+
<TestWidget widgetId="t2" onSlot={() => {}} />
|
|
62
62
|
<TestWidget widgetId="t3" onSlot={(s) => { slot3 = s }} />
|
|
63
63
|
</WebGLContextPoolProvider>
|
|
64
64
|
)
|
|
@@ -93,11 +93,11 @@ describe('WebGLContextPool', () => {
|
|
|
93
93
|
})
|
|
94
94
|
|
|
95
95
|
it('tracks generation across live-frozen-live transitions', () => {
|
|
96
|
-
let
|
|
96
|
+
let slot3
|
|
97
97
|
render(
|
|
98
98
|
<WebGLContextPoolProvider maxLive={2}>
|
|
99
|
-
<TestWidget widgetId="t1" onSlot={(
|
|
100
|
-
<TestWidget widgetId="t2" onSlot={(
|
|
99
|
+
<TestWidget widgetId="t1" onSlot={() => {}} />
|
|
100
|
+
<TestWidget widgetId="t2" onSlot={() => {}} />
|
|
101
101
|
<TestWidget widgetId="t3" onSlot={(s) => { slot3 = s }} />
|
|
102
102
|
</WebGLContextPoolProvider>
|
|
103
103
|
)
|
|
@@ -141,10 +141,10 @@ describe('WebGLContextPool', () => {
|
|
|
141
141
|
})
|
|
142
142
|
|
|
143
143
|
it('selected widgets get PINNED priority via visibility updater', () => {
|
|
144
|
-
let
|
|
144
|
+
let slot2, updater
|
|
145
145
|
render(
|
|
146
146
|
<WebGLContextPoolProvider maxLive={1}>
|
|
147
|
-
<TestWidget widgetId="t1" onSlot={(
|
|
147
|
+
<TestWidget widgetId="t1" onSlot={() => {}} />
|
|
148
148
|
<TestWidget widgetId="t2" onSlot={(s) => { slot2 = s }} />
|
|
149
149
|
<TestUpdater onUpdater={(u) => { updater = u }} />
|
|
150
150
|
</WebGLContextPoolProvider>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// The jsx- system is dormant (no canvases define a `jsx` field).
|
|
5
5
|
import WidgetWrapper from './WidgetWrapper.jsx'
|
|
6
6
|
|
|
7
|
-
export default function ComponentWidget({ component: Component
|
|
7
|
+
export default function ComponentWidget({ component: Component }) {
|
|
8
8
|
if (!Component) return null
|
|
9
9
|
return (
|
|
10
10
|
<WidgetWrapper>
|
|
@@ -1012,7 +1012,12 @@ export default function storyboardDataPlugin() {
|
|
|
1012
1012
|
// can't trace into its deps. Include the remark entry points so
|
|
1013
1013
|
// Vite pre-bundles the full chain — covers all transitive CJS
|
|
1014
1014
|
// packages (debug, extend, etc.) without whack-a-mole.
|
|
1015
|
-
include: [
|
|
1015
|
+
include: [
|
|
1016
|
+
'cmdk',
|
|
1017
|
+
'remark', 'remark-gfm', 'remark-html',
|
|
1018
|
+
'use-sync-external-store/shim', 'use-sync-external-store/shim/with-selector',
|
|
1019
|
+
'feather-icons', '@primer/octicons', 'ansi-to-html',
|
|
1020
|
+
],
|
|
1016
1021
|
exclude: ['@dfosco/storyboard'],
|
|
1017
1022
|
},
|
|
1018
1023
|
}
|