@dfosco/storyboard 0.5.0-beta.46 → 0.5.0-beta.47
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
CHANGED
|
@@ -963,6 +963,10 @@ function BranchNav({ basePath }) {
|
|
|
963
963
|
const { branches, currentBranch, branchBasePath } = useBranches(basePath)
|
|
964
964
|
const [switching, setSwitching] = useState(null)
|
|
965
965
|
|
|
966
|
+
// Branch switcher is meaningful only in deployed environments where users
|
|
967
|
+
// need to jump between branch deploys. In local dev each worktree is its own
|
|
968
|
+
// process; switching is handled via `sb dev` / `sb code`.
|
|
969
|
+
if (isLocalDev) return null
|
|
966
970
|
if (!branches || branches.length === 0) return null
|
|
967
971
|
|
|
968
972
|
const branchNames = branches.map(b => b.branch)
|
|
@@ -1394,6 +1394,41 @@ export default function storyboardDataPlugin() {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
},
|
|
1396
1396
|
|
|
1397
|
+
// Guard against known invalid named imports from @primer/react.
|
|
1398
|
+
// The most common offender is `Octicon`, which lives in
|
|
1399
|
+
// `@primer/octicons-react`, not `@primer/react`. When a consumer
|
|
1400
|
+
// writes `import { Octicon } from '@primer/react'`, Vite happily
|
|
1401
|
+
// pre-bundles the dep and only fails at runtime with a cryptic
|
|
1402
|
+
// "does not provide an export named 'Octicon'" error from inside
|
|
1403
|
+
// `node_modules/.vite/deps/@primer_react.js`. Catch it here at
|
|
1404
|
+
// transform time with a clear, actionable error pointing to the
|
|
1405
|
+
// correct package.
|
|
1406
|
+
transform(code, id) {
|
|
1407
|
+
if (!/\.(jsx?|tsx?|mjs|cjs)(\?|$)/.test(id)) return null
|
|
1408
|
+
if (id.includes('/node_modules/')) return null
|
|
1409
|
+
if (!code.includes('@primer/react')) return null
|
|
1410
|
+
const re = /import\s*(?:type\s*)?\{([^}]*)\}\s*from\s*['"]@primer\/react['"]/g
|
|
1411
|
+
let match
|
|
1412
|
+
while ((match = re.exec(code)) !== null) {
|
|
1413
|
+
const names = match[1]
|
|
1414
|
+
.split(',')
|
|
1415
|
+
.map(s => s.replace(/\s+as\s+\w+/, '').trim())
|
|
1416
|
+
.filter(Boolean)
|
|
1417
|
+
if (names.includes('Octicon')) {
|
|
1418
|
+
const before = code.slice(0, match.index)
|
|
1419
|
+
const line = before.split('\n').length
|
|
1420
|
+
const rel = id.replace(root + '/', '')
|
|
1421
|
+
throw new Error(
|
|
1422
|
+
`[storyboard] Invalid import in ${rel}:${line} — \`Octicon\` is not exported by \`@primer/react\`.\n` +
|
|
1423
|
+
` Import the icon you need directly from \`@primer/octicons-react\` instead, e.g.:\n` +
|
|
1424
|
+
` import { GearIcon } from '@primer/octicons-react'\n` +
|
|
1425
|
+
` See AGENTS.md: "Use Primer Octicons from @primer/octicons-react for icons".`
|
|
1426
|
+
)
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return null
|
|
1430
|
+
},
|
|
1431
|
+
|
|
1397
1432
|
handleHotUpdate(ctx) {
|
|
1398
1433
|
const normalized = ctx.file.replace(/\\/g, '/')
|
|
1399
1434
|
if (!/\.canvas\.jsonl$/.test(normalized)) return
|