@adea-ai/ui 0.152.1 → 0.152.2

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.
Files changed (44) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js +2 -2
  2. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  3. package/dist/components/composites/appearance-editor/appearance-editor.js +3 -3
  4. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  5. package/dist/components/composites/terminal/terminal.js +1 -1
  6. package/dist/components/composites/terminal/terminal.js.map +1 -1
  7. package/dist/components/composites/update-dialog/channel-control.js +3 -3
  8. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  9. package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
  10. package/dist/components/composites/update-dialog/update-dialog.js +3 -3
  11. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  12. package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
  13. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  14. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  15. package/dist/components/conversation/message-composer.js +1 -1
  16. package/dist/components/conversation/message-composer.js.map +1 -1
  17. package/dist/components/layout/split-layout/split-layout.js +1 -1
  18. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  19. package/dist/components/theme/appearance-panel.d.ts.map +1 -1
  20. package/dist/components/theme/appearance-panel.js +1 -1
  21. package/dist/components/theme/appearance-panel.js.map +1 -1
  22. package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  23. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  24. package/dist/r/src/components/composites/terminal/terminal.tsx +2 -2
  25. package/dist/r/src/components/composites/update-dialog/channel-control.tsx +3 -3
  26. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  27. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  28. package/dist/r/src/components/conversation/message-composer.tsx +1 -2
  29. package/dist/r/src/components/layout/split-layout/split-layout.tsx +1 -1
  30. package/dist/r/src/components/theme/appearance-panel.tsx +2 -4
  31. package/dist/vite/tailwind-sources.d.ts.map +1 -1
  32. package/dist/vite/tailwind-sources.js +49 -9
  33. package/dist/vite/tailwind-sources.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  36. package/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  37. package/src/components/composites/terminal/terminal.tsx +2 -2
  38. package/src/components/composites/update-dialog/channel-control.tsx +3 -3
  39. package/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  40. package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  41. package/src/components/conversation/message-composer.tsx +1 -2
  42. package/src/components/layout/split-layout/split-layout.tsx +1 -1
  43. package/src/components/theme/appearance-panel.tsx +2 -4
  44. package/src/vite/tailwind-sources.ts +67 -7
@@ -1,17 +1,30 @@
1
1
  import { defaultExport, directRuntimeExports, dynamicRuntimeImports, hasRuntimeDeclaration, parseSource, runtimeReexports, selectNamespace, staticRuntimeImports } from "./source-parser.js";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
2
3
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, symlinkSync, writeFileSync } from "node:fs";
3
4
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
4
5
  import { normalizePath } from "vite";
5
6
  // src/vite/tailwind-sources.ts
6
7
  var defaultLabel = "ui-tailwind-sources";
8
+ var walkMemoStore = new AsyncLocalStorage();
9
+ var currentWalkMemo = () => walkMemoStore.getStore();
10
+ function withWalkMemo(walk) {
11
+ if (currentWalkMemo()) return walk();
12
+ return walkMemoStore.run({
13
+ realpaths: /* @__PURE__ */ new Map(),
14
+ modules: /* @__PURE__ */ new Map()
15
+ }, walk);
16
+ }
7
17
  function modulePath(id) {
8
18
  const withoutQuery = id.split("?")[0] ?? id;
9
19
  const absolute = resolve(withoutQuery);
20
+ const known = currentWalkMemo()?.realpaths.get(absolute);
21
+ if (known) return known;
22
+ let file = absolute;
10
23
  try {
11
- return realpathSync(absolute);
12
- } catch {
13
- return absolute;
14
- }
24
+ file = realpathSync(absolute);
25
+ } catch {}
26
+ currentWalkMemo()?.realpaths.set(absolute, file);
27
+ return file;
15
28
  }
16
29
  function inside(path, root) {
17
30
  const pathFromRoot = relative(root, path);
@@ -47,7 +60,15 @@ function readModule(path, cache) {
47
60
  cache.set(file, parsed);
48
61
  return parsed;
49
62
  }
63
+ var runtimeImportsByModule = /* @__PURE__ */ new WeakMap();
50
64
  function runtimeImports(parsed, label) {
65
+ const known = runtimeImportsByModule.get(parsed);
66
+ if (known) return known;
67
+ const imports = moduleRuntimeImports(parsed, label);
68
+ runtimeImportsByModule.set(parsed, imports);
69
+ return imports;
70
+ }
71
+ function moduleRuntimeImports(parsed, label) {
51
72
  const imports = [];
52
73
  for (const entry of staticRuntimeImports(parsed.syntax)) {
53
74
  if (entry.kind === "side-effect") {
@@ -94,13 +115,16 @@ function hasLocalRuntimeBinding(file, localName, cache) {
94
115
  function modifierExport(file, name, cache) {
95
116
  return directRuntimeExports(readModule(file, cache).syntax).includes(name);
96
117
  }
97
- async function collectUiSourceFiles(options) {
118
+ function collectUiSourceFiles(options) {
119
+ return withWalkMemo(() => walkUiSourceFiles(options));
120
+ }
121
+ async function walkUiSourceFiles(options) {
98
122
  const label = options.label ?? defaultLabel;
99
123
  const repositoryRoot = realpathSync(options.repositoryRoot);
100
124
  const uiSourceRoot = realpathSync(options.uiSourceRoot);
101
125
  const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root));
102
126
  const entrypoints = (Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]).map((entrypoint) => realpathSync(entrypoint));
103
- const cache = /* @__PURE__ */ new Map();
127
+ const cache = currentWalkMemo()?.modules ?? /* @__PURE__ */ new Map();
104
128
  const visited = /* @__PURE__ */ new Set();
105
129
  const files = /* @__PURE__ */ new Set();
106
130
  const publishedUiResolutions = [];
@@ -332,13 +356,16 @@ async function frameworkSourceRoots(resolveId, entrypoint, label = defaultLabel)
332
356
  * imports are included without executing them, so a lazy feature cannot fail
333
357
  * later on an import the check never saw.
334
358
  */
335
- async function collectLinkedImports(options) {
359
+ function collectLinkedImports(options) {
360
+ return withWalkMemo(() => walkLinkedImports(options));
361
+ }
362
+ async function walkLinkedImports(options) {
336
363
  const label = options.label ?? defaultLabel;
337
364
  const repositoryRoot = realpathSync(options.repositoryRoot);
338
365
  const uiSourceRoot = realpathSync(options.uiSourceRoot);
339
366
  const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root));
340
367
  const entrypoints = (Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]).map((entrypoint) => realpathSync(entrypoint));
341
- const cache = /* @__PURE__ */ new Map();
368
+ const cache = currentWalkMemo()?.modules ?? /* @__PURE__ */ new Map();
342
369
  const visited = /* @__PURE__ */ new Set();
343
370
  const linked = [];
344
371
  const reached = (file) => isCodeFile(file) && (inside(file, uiSourceRoot) || isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots));
@@ -411,7 +438,20 @@ function tailwindSources(options) {
411
438
  let sourcePackageRoots = [];
412
439
  let repositoryRoot = "";
413
440
  let generatedFiles = [];
414
- const generate = async (resolveId, config) => {
441
+ const generate = (uncachedResolveId, config) => {
442
+ const resolutions = /* @__PURE__ */ new Map();
443
+ const resolveId = (specifier, importer) => {
444
+ const key = `${specifier}\0${importer}`;
445
+ let resolved = resolutions.get(key);
446
+ if (!resolved) {
447
+ resolved = uncachedResolveId(specifier, importer);
448
+ resolutions.set(key, resolved);
449
+ }
450
+ return resolved;
451
+ };
452
+ return withWalkMemo(() => generateWith(resolveId, config));
453
+ };
454
+ const generateWith = async (resolveId, config) => {
415
455
  const files = await collectUiSourceFiles({
416
456
  entrypoint: paths.entrypoints,
417
457
  repositoryRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind-sources.js","names":[],"sources":["../../src/vite/tailwind-sources.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n realpathSync,\n symlinkSync,\n writeFileSync,\n} from 'node:fs'\nimport { basename, dirname, extname, isAbsolute, relative, resolve, sep } from 'node:path'\nimport {\n defaultExport,\n directRuntimeExports,\n runtimeReexports,\n dynamicRuntimeImports,\n hasRuntimeDeclaration,\n parseSource,\n type SyntaxNode,\n selectNamespace,\n staticRuntimeImports,\n} from './source-parser'\n\nimport { normalizePath, type Plugin, type ResolvedConfig } from 'vite'\n\nexport type Selection =\n | { kind: 'execute' | 'side-effect' | 'all' }\n | { kind: 'named'; names: string[] }\n\ninterface RuntimeImport {\n specifier: string\n selection: Selection\n}\n\ninterface ExportTarget {\n file: string\n selection: Selection\n}\n\ninterface ParsedModule {\n file: string\n syntax: SyntaxNode\n}\n\nexport interface SourceDiscoveryOptions {\n entrypoint: string | string[]\n repositoryRoot: string\n uiPackageRoot: string\n uiSourceRoot: string\n /** Source roots of installed packages (such as the app framework) whose shared views render UI modules. */\n sourcePackageRoots?: string[]\n resolveId(specifier: string, importer: string): Promise<string | undefined>\n /** Error-message prefix naming the consumer. */\n label?: string\n}\n\nexport interface SourceDirectiveOptions {\n files: string[]\n uiPackageRoot: string\n stablePackagePath: string\n stylesheetPath: string\n label?: string\n}\n\nconst defaultLabel = 'ui-tailwind-sources'\n\nfunction modulePath(id: string): string {\n const withoutQuery = id.split('?')[0] ?? id\n const absolute = resolve(withoutQuery)\n try {\n return realpathSync(absolute)\n } catch {\n return absolute\n }\n}\n\nfunction inside(path: string, root: string): boolean {\n const pathFromRoot = relative(root, path)\n return (\n pathFromRoot === '' ||\n (pathFromRoot !== '..' && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot))\n )\n}\n\nfunction isWorkspaceSourceFile(\n path: string,\n repositoryRoot: string,\n sourcePackageRoots: readonly string[] = []\n): boolean {\n if (sourcePackageRoots.some((root) => inside(path, root))) return true\n if (!inside(path, repositoryRoot)) return false\n const segments = relative(repositoryRoot, path).split(sep)\n return (\n (segments[0] === 'apps' || segments[0] === 'packages') &&\n segments.includes('src') &&\n !segments.includes('node_modules')\n )\n}\n\nfunction isCodeFile(path: string): boolean {\n return ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'].includes(extname(path))\n}\n\nfunction readModule(path: string, cache: Map<string, ParsedModule>): ParsedModule {\n const file = modulePath(path)\n const cached = cache.get(file)\n if (cached) return cached\n const source = readFileSync(file, 'utf8')\n const parsed: ParsedModule = { file, syntax: parseSource(file, source) }\n cache.set(file, parsed)\n return parsed\n}\n\nfunction runtimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {\n const imports: RuntimeImport[] = []\n\n for (const entry of staticRuntimeImports(parsed.syntax)) {\n if (entry.kind === 'side-effect') {\n imports.push({\n specifier: entry.specifier,\n selection: { kind: 'side-effect' },\n })\n continue\n }\n const namespace = entry.bindings.find((binding) => binding.imported === '*')\n if (namespace) {\n const selection = selectNamespace(parsed.syntax, namespace.local)\n if (selection) imports.push({ specifier: entry.specifier, selection })\n } else {\n imports.push({\n specifier: entry.specifier,\n selection: {\n kind: 'named',\n names: [...new Set(entry.bindings.map((binding) => binding.imported))].toSorted(),\n },\n })\n }\n }\n\n imports.push(...dynamicRuntimeImports(parsed.syntax, parsed.file, label))\n return imports\n}\n\nfunction localRuntimeBinding(\n file: string,\n localName: string,\n cache: Map<string, ParsedModule>\n): RuntimeImport | undefined {\n const parsed = readModule(file, cache)\n for (const entry of staticRuntimeImports(parsed.syntax)) {\n const binding = entry.bindings.find((candidate) => candidate.local === localName)\n if (binding)\n return {\n specifier: entry.specifier,\n selection:\n binding.imported === '*' ? { kind: 'all' } : { kind: 'named', names: [binding.imported] },\n }\n }\n return undefined\n}\n\nfunction hasLocalRuntimeBinding(\n file: string,\n localName: string,\n cache: Map<string, ParsedModule>\n): boolean {\n return hasRuntimeDeclaration(readModule(file, cache).syntax, localName)\n}\n\nfunction modifierExport(file: string, name: string, cache: Map<string, ParsedModule>): boolean {\n return directRuntimeExports(readModule(file, cache).syntax).includes(name)\n}\n\nexport async function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {\n const label = options.label ?? defaultLabel\n const repositoryRoot = realpathSync(options.repositoryRoot)\n const uiSourceRoot = realpathSync(options.uiSourceRoot)\n const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))\n const entrypoints = (\n Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]\n ).map((entrypoint) => realpathSync(entrypoint))\n const cache = new Map<string, ParsedModule>()\n const visited = new Set<string>()\n const files = new Set<string>()\n const publishedUiResolutions: string[] = []\n\n const resolveImport = async (\n specifier: string,\n importer: string,\n selection: Selection\n ): Promise<void> => {\n const importerIsUi = inside(importer, uiSourceRoot)\n const isPublishedUiImport = specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/')\n const resolved = await options.resolveId(specifier, importer)\n if (isPublishedUiImport)\n publishedUiResolutions.push(`${specifier} -> ${resolved ?? '(unresolved)'}`)\n if (!resolved) {\n if (isPublishedUiImport || importerIsUi)\n throw new Error(\n `[${label}] unable to resolve runtime import '${specifier}' from ${importer}`\n )\n return\n }\n\n const target = modulePath(resolved)\n if (!isCodeFile(target)) return\n if (isPublishedUiImport && !inside(target, uiSourceRoot)) {\n throw new Error(`[${label}] '${specifier}' resolved outside published UI source: ${target}`)\n }\n if (\n inside(target, uiSourceRoot) ||\n isWorkspaceSourceFile(target, repositoryRoot, sourcePackageRoots)\n ) {\n await visit(target, selection)\n return\n }\n }\n\n const resolveExportTargets = async (\n file: string,\n name: string,\n chain: Set<string>\n ): Promise<ExportTarget[]> => {\n const key = `${file}\\0${name}`\n if (chain.has(key)) return []\n const nextChain = new Set(chain).add(key)\n const parsed = readModule(file, cache)\n const targets: ExportTarget[] = []\n\n if (modifierExport(file, name, cache)) targets.push({ file, selection: { kind: 'execute' } })\n\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (entry.kind === 'empty') continue\n if (entry.kind === 'named' && !entry.source) {\n if (entry.exported !== name) continue\n const imported = localRuntimeBinding(file, entry.imported, cache)\n if (imported) {\n const resolved = await options.resolveId(imported.specifier, file)\n if (resolved)\n targets.push({\n file: modulePath(resolved),\n selection: imported.selection,\n })\n else if (inside(file, uiSourceRoot))\n throw new Error(\n `[${label}] unable to resolve local re-export '${imported.specifier}' from ${file}`\n )\n } else if (hasLocalRuntimeBinding(file, entry.imported, cache))\n targets.push({ file, selection: { kind: 'execute' } })\n continue\n }\n if (\n !entry.source ||\n (entry.kind !== 'star' && entry.exported !== name) ||\n (entry.kind === 'star' && name === 'default')\n )\n continue\n if (entry.source === 'lucide-solid') {\n targets.push({ file, selection: { kind: 'execute' } })\n continue\n }\n const resolved = await options.resolveId(entry.source, file)\n if (!resolved) {\n if (inside(file, uiSourceRoot) && entry.kind !== 'namespace')\n throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)\n continue\n }\n if (entry.kind === 'star')\n targets.push(...(await resolveExportTargets(modulePath(resolved), name, nextChain)))\n else if (entry.kind === 'namespace')\n targets.push({\n file: modulePath(resolved),\n selection: { kind: 'all' },\n })\n else\n targets.push({\n file: modulePath(resolved),\n selection: { kind: 'named', names: [entry.imported] },\n })\n }\n if (name === 'default') {\n const entry = defaultExport(parsed.syntax)\n if (entry?.kind === 'identifier') {\n const imported = localRuntimeBinding(file, entry.name, cache)\n if (imported) {\n const resolved = await options.resolveId(imported.specifier, file)\n if (resolved)\n targets.push({\n file: modulePath(resolved),\n selection: imported.selection,\n })\n } else targets.push({ file, selection: { kind: 'execute' } })\n } else if (entry) targets.push({ file, selection: { kind: 'execute' } })\n }\n\n return deduplicateTargets(targets)\n }\n\n const runtimeExportNames = async (file: string, chain: Set<string>): Promise<string[]> => {\n if (chain.has(file)) return []\n const nextChain = new Set(chain).add(file)\n const parsed = readModule(file, cache)\n const names = new Set(directRuntimeExports(parsed.syntax))\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (!entry.source) {\n if (entry.kind === 'named') names.add(entry.exported)\n continue\n }\n if (entry.kind === 'star' && entry.source === 'lucide-solid') continue\n const resolved = await options.resolveId(entry.source, file)\n if (!resolved) {\n if (inside(file, uiSourceRoot))\n throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)\n continue\n }\n if (entry.kind === 'named' || entry.kind === 'namespace') names.add(entry.exported)\n else if (entry.kind === 'star')\n for (const name of await runtimeExportNames(modulePath(resolved), nextChain))\n if (name !== 'default') names.add(name)\n }\n return [...names].toSorted()\n }\n\n const visit = async (path: string, selection: Selection): Promise<void> => {\n const file = modulePath(path)\n if (!isCodeFile(file)) return\n if (\n !inside(file, uiSourceRoot) &&\n !isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots)\n )\n return\n const key = `${file}\\0${selection.kind === 'named' ? selection.names.join(',') : selection.kind}`\n if (visited.has(key)) return\n visited.add(key)\n const parsed = readModule(file, cache)\n const isUiSource = inside(file, uiSourceRoot)\n if (isUiSource) files.add(file)\n\n const moduleImports = runtimeImports(parsed, label)\n // Follow all runtime imports of every visited module. Even when a module\n // is reached through a side-effect import, its own imports may execute\n // setup code or register UI components needed by the consumer.\n for (const dependency of moduleImports) {\n await resolveImport(dependency.specifier, file, dependency.selection)\n }\n\n if (selection.kind === 'execute' || selection.kind === 'side-effect') return\n const names =\n selection.kind === 'named' ? selection.names : await runtimeExportNames(file, new Set())\n for (const name of names) {\n const targets = await resolveExportTargets(file, name, new Set())\n if (!targets.length) {\n throw new Error(`[${label}] unable to resolve runtime export '${name}' from ${file}`)\n }\n for (const target of targets) await visit(target.file, target.selection)\n }\n }\n\n for (const entrypoint of entrypoints) await visit(entrypoint, { kind: 'execute' })\n if (files.size === 0)\n throw new Error(\n `[${label}] the client import graph resolved no shared UI source files from ${entrypoints.join(', ')}; package imports: ${publishedUiResolutions.slice(0, 8).join('; ') || '(none)'}`\n )\n return [...files].toSorted()\n}\n\nfunction deduplicateTargets(targets: ExportTarget[]): ExportTarget[] {\n const unique = new Map<string, ExportTarget>()\n for (const target of targets) {\n const key = `${target.file}\\0${target.selection.kind === 'named' ? target.selection.names.join(',') : target.selection.kind}`\n unique.set(key, target)\n }\n return [...unique.values()]\n}\n\nfunction filesBelow(directory: string): string[] {\n return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {\n const path = resolve(directory, entry.name)\n if (entry.isDirectory()) return filesBelow(path)\n return entry.isFile() ? [path] : []\n })\n}\n\n/**\n * Tailwind's scanner widens a file `@source` to that file's whole directory\n * tree, so a reached `button/button.tsx` would also pull in an unused sibling\n * (and a reached package-root barrel would pull in every component). Negate\n * every file in those trees the import graph did not reach to keep discovery\n * exact to the module.\n */\nexport function formatUiSourceDirectives(options: SourceDirectiveOptions): string {\n const label = options.label ?? defaultLabel\n const packageRoot = realpathSync(options.uiPackageRoot)\n const stylesheetDirectory = dirname(resolve(options.stylesheetPath))\n const directive = (file: string, negated: boolean) => {\n if (!inside(file, packageRoot))\n throw new Error(`[${label}] source is outside published package: ${file}`)\n const stableFile = resolve(options.stablePackagePath, relative(packageRoot, file))\n const relativePath = relative(stylesheetDirectory, stableFile).replaceAll('\\\\', '/')\n if (isAbsolute(relativePath))\n throw new Error(`[${label}] generated source path is not portable: ${relativePath}`)\n return `@source ${negated ? 'not ' : ''}'${relativePath}';`\n }\n const included = [...new Set(options.files.map((path) => realpathSync(path)))].toSorted()\n const includedSet = new Set(included)\n const scannedTrees = [...new Set(included.map((file) => dirname(file)))]\n .toSorted()\n .filter((directory, index, all) => !all.slice(0, index).some((root) => inside(directory, root)))\n const excluded = scannedTrees\n .flatMap((directory) => filesBelow(directory))\n .filter((file) => !includedSet.has(file))\n .toSorted()\n return `${[\n ...included.map((file) => directive(file, false)),\n ...excluded.map((file) => directive(file, true)),\n ].join('\\n')}\\n`\n}\n\n/**\n * The rendered shared UI source modules (by package-relative path) that the\n * generated directives do not cover. Ids may carry Vite query suffixes.\n */\nexport function missingRenderedUiSources(\n renderedIds: string[],\n generatedFiles: string[],\n uiRoot: string\n): string[] {\n const uiSourceRoot = resolve(uiRoot, 'src')\n const generated = new Set(generatedFiles.map((file) => modulePath(file)))\n return [\n ...new Set(\n renderedIds\n .map((id) => modulePath(id))\n .filter((file) => isCodeFile(file) && inside(file, uiSourceRoot) && !generated.has(file))\n .map((file) => relative(uiRoot, file).replaceAll('\\\\', '/'))\n ),\n ].toSorted()\n}\n\nfunction writeIfChanged(path: string, content: string) {\n let current: string | undefined\n try {\n current = readFileSync(path, 'utf8')\n } catch {\n // The first invocation creates the ignored generated file.\n }\n if (current === content) return\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, content)\n}\n\n/**\n * The framework package's published `src` directory holding `file`: the\n * nearest `src` ancestor whose parent is the @adea-ai/app-framework package.\n * Its views live in subdirectories (`src/views`) and import across `src`.\n */\nfunction frameworkSourceRoot(file: string): string {\n for (\n let directory = dirname(file);\n dirname(directory) !== directory;\n directory = dirname(directory)\n ) {\n if (basename(directory) !== 'src') continue\n try {\n const manifest = JSON.parse(readFileSync(resolve(directory, '../package.json'), 'utf8')) as {\n name?: unknown\n }\n if (manifest.name === '@adea-ai/app-framework') return directory\n } catch {\n // Not the package root; keep walking up.\n }\n }\n return dirname(file)\n}\n\n/**\n * The framework's shared views (Help Center and friends) import shared UI\n * modules from its published source, so its graph counts as the app's.\n */\nexport async function frameworkSourceRoots(\n resolveId: (specifier: string, importer: string) => Promise<string | undefined>,\n entrypoint: string,\n label = defaultLabel\n): Promise<string[]> {\n const framework = await resolveId('@adea-ai/app-framework/app-help', entrypoint)\n if (!framework) return []\n const root = frameworkSourceRoot(realpathSync(modulePath(framework)))\n if (basename(root) !== 'src')\n throw new Error(\n `[${label}] @adea-ai/app-framework resolved outside its published source: ${root}`\n )\n return [root]\n}\n\nexport interface LinkedImport {\n /** The shared UI source module that imports or re-exports the specifier. */\n file: string\n selection: Selection\n}\n\nexport interface LinkedImportOptions {\n entrypoint: string | string[]\n repositoryRoot: string\n uiSourceRoot: string\n sourcePackageRoots?: string[]\n /** The external package whose uses inside shared UI source are reported. */\n specifier: string\n resolveId(specifier: string, importer: string): Promise<string | undefined>\n label?: string\n}\n\n/**\n * Every use of `specifier` inside shared UI source the dev server links.\n *\n * Vite serves the published package as native ESM, so static imports and\n * re-exports are linked even when the consumer selects one root-barrel name,\n * unlike the selective walk the Tailwind sources come from. Literal dynamic\n * imports are included without executing them, so a lazy feature cannot fail\n * later on an import the check never saw.\n */\nexport async function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {\n const label = options.label ?? defaultLabel\n const repositoryRoot = realpathSync(options.repositoryRoot)\n const uiSourceRoot = realpathSync(options.uiSourceRoot)\n const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))\n const entrypoints = (\n Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]\n ).map((entrypoint) => realpathSync(entrypoint))\n const cache = new Map<string, ParsedModule>()\n const visited = new Set<string>()\n const linked: LinkedImport[] = []\n const reached = (file: string) =>\n isCodeFile(file) &&\n (inside(file, uiSourceRoot) || isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots))\n\n const visit = async (path: string): Promise<void> => {\n const file = modulePath(path)\n if (!reached(file) || visited.has(file)) return\n visited.add(file)\n const inUi = inside(file, uiSourceRoot)\n const parsed = readModule(file, cache)\n const record = (selection: Selection) => {\n if (inUi) linked.push({ file, selection })\n }\n const follow = async (specifier: string, kind: string): Promise<void> => {\n const resolved = await options.resolveId(specifier, file)\n if (!resolved) {\n if (inUi || specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/'))\n throw new Error(`[${label}] unable to resolve ${kind} '${specifier}' from ${file}`)\n return\n }\n await visit(resolved)\n }\n\n for (const dependency of runtimeImports(parsed, label)) {\n if (dependency.specifier === options.specifier) record(dependency.selection)\n else await follow(dependency.specifier, 'runtime import')\n }\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (!entry.source) continue\n if (entry.source !== options.specifier) await follow(entry.source, 're-export')\n else if (entry.kind === 'named') record({ kind: 'named', names: [entry.imported] })\n else if (entry.kind === 'empty') record({ kind: 'named', names: [] })\n else record({ kind: 'all' })\n }\n }\n\n for (const entrypoint of entrypoints) await visit(entrypoint)\n return linked\n}\n\nexport interface GraphCheckContext {\n command: ResolvedConfig['command']\n repositoryRoot: string\n /** The shared UI source modules the client graph reaches. */\n files: string[]\n /** Uses of an external package inside the shared UI source the dev server links. */\n linkedImports(specifier: string): Promise<LinkedImport[]>\n}\n\nexport interface TailwindSourcesOptions {\n /** Names the plugin, its errors and the generated `<name>-ui-tailwind-sources` cache files. */\n name: string\n /** The Vite root of the consuming app. */\n webRoot: string\n /** Client entry modules, relative to `webRoot`. */\n entrypoints: string[]\n /** The stylesheet that imports the generated directives, relative to `webRoot`. */\n styleEntry: string\n /** The monorepo root whose `apps/*` and `packages/*` sources count as the app's. Defaults to `webRoot/../..`. */\n repositoryRoot?: string\n /** More paths the dev server watches, relative to `webRoot`. */\n watch?: string[]\n /** Runs after each generation, in dev and in builds, to enforce app-specific graph rules. */\n check?(context: GraphCheckContext): void | Promise<void>\n}\n\nexport interface UiSourcePaths {\n entrypoints: string[]\n repositoryRoot: string\n stablePackagePath: string\n stylesheetPath: string\n manifestPath: string\n styleEntry: string\n}\n\n// The generated directives live in the ignored Vite cache next to the stable\n// package link they reference, so every path in them stays checkout-relative.\nexport function uiSourcePaths(options: TailwindSourcesOptions): UiSourcePaths {\n const { webRoot, name } = options\n return {\n entrypoints: options.entrypoints.map((entrypoint) => resolve(webRoot, entrypoint)),\n repositoryRoot: resolve(webRoot, options.repositoryRoot ?? '../..'),\n stablePackagePath: resolve(webRoot, 'node_modules/@adea-ai/ui'),\n stylesheetPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.css`),\n manifestPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.json`),\n styleEntry: resolve(webRoot, options.styleEntry),\n }\n}\n\ntype Resolver = (specifier: string, importer: string) => Promise<string | undefined>\n\nfunction viteResolver(config: ResolvedConfig): Resolver {\n const resolver = config.createResolver()\n return (specifier, importer) => resolver(specifier, importer, false, false)\n}\n\n/**\n * Generate Tailwind `@source` directives for exactly the published shared UI\n * modules the app's client graph reaches (static, re-exported and literal lazy\n * imports), instead of scanning every component the package ships. The client\n * build then fails if Rolldown rendered a shared UI module the directives\n * missed, so a discovery gap can never ship unstyled.\n */\nexport function tailwindSources(options: TailwindSourcesOptions): Plugin {\n const label = `${options.name}-ui-tailwind-sources`\n const paths = uiSourcePaths(options)\n let uiRoot = ''\n let uiSourceRoot = ''\n let sourcePackageRoots: string[] = []\n let repositoryRoot = ''\n let generatedFiles: string[] = []\n\n const generate = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {\n const files = await collectUiSourceFiles({\n entrypoint: paths.entrypoints,\n repositoryRoot,\n uiPackageRoot: uiRoot,\n uiSourceRoot,\n sourcePackageRoots,\n resolveId,\n label,\n })\n await options.check?.({\n command: config.command,\n repositoryRoot,\n files,\n linkedImports: (specifier) =>\n collectLinkedImports({\n entrypoint: paths.entrypoints,\n repositoryRoot,\n uiSourceRoot,\n sourcePackageRoots,\n specifier,\n resolveId,\n label,\n }),\n })\n writeIfChanged(\n paths.stylesheetPath,\n formatUiSourceDirectives({\n files,\n uiPackageRoot: uiRoot,\n stablePackagePath: paths.stablePackagePath,\n stylesheetPath: paths.stylesheetPath,\n label,\n })\n )\n writeIfChanged(\n paths.manifestPath,\n `${JSON.stringify(packageRelativePaths(files, uiRoot), null, 2)}\\n`\n )\n return files\n }\n\n return {\n name: label,\n enforce: 'pre',\n async configResolved(config) {\n repositoryRoot = realpathSync(paths.repositoryRoot)\n const resolveId = viteResolver(config)\n const entrypoint = paths.entrypoints[0]\n if (!entrypoint) throw new Error(`[${label}] no client entrypoints`)\n const manifest = await resolveId('@adea-ai/ui/package.json', entrypoint)\n if (!manifest) throw new Error(`[${label}] unable to resolve @adea-ai/ui/package.json`)\n uiRoot = realpathSync(dirname(modulePath(manifest)))\n uiSourceRoot = realpathSync(resolve(uiRoot, 'src'))\n sourcePackageRoots = await frameworkSourceRoots(resolveId, entrypoint, label)\n // Bun links the package here; a hoisted install may not, while the\n // generated directives reference the package through this stable path.\n if (!existsSync(paths.stablePackagePath)) {\n mkdirSync(dirname(paths.stablePackagePath), { recursive: true })\n symlinkSync(uiRoot, paths.stablePackagePath, 'dir')\n }\n if (realpathSync(paths.stablePackagePath) !== uiRoot)\n throw new Error(\n `[${label}] stable package link ${paths.stablePackagePath} does not resolve to ${uiRoot}`\n )\n generatedFiles = await generate(resolveId, config)\n },\n configureServer(server) {\n for (const path of options.watch ?? []) server.watcher.add(resolve(options.webRoot, path))\n },\n async handleHotUpdate({ file, modules, server }) {\n if (!generatedFiles.length || !isCodeFile(file)) return\n const previous = packageRelativePaths(generatedFiles, uiRoot).join('\\n')\n generatedFiles = await generate(viteResolver(server.config), server.config)\n if (packageRelativePaths(generatedFiles, uiRoot).join('\\n') === previous) return\n // Keep lexical graph keys; aliased roots may use their physical path instead.\n const styles =\n server.moduleGraph.getModulesByFile(normalizePath(paths.styleEntry)) ??\n server.moduleGraph.getModulesByFile(normalizePath(modulePath(paths.styleEntry)))\n if (!styles) return\n for (const module of styles) server.moduleGraph.invalidateModule(module)\n // Returning only the stylesheet would drop the edited module from the\n // update list, so keep the modules Vite already selected for the file.\n return [...new Set([...modules, ...styles])]\n },\n generateBundle(_options, bundle) {\n // Server bundles render shared UI the client never ships; Tailwind only\n // styles the client.\n const environment = (this as { environment?: { config: { consumer?: string } } }).environment\n if (environment && environment.config.consumer !== 'client') return\n const renderedIds: string[] = []\n for (const output of Object.values(bundle)) {\n if (output.type !== 'chunk') continue\n for (const [id, module] of Object.entries(output.modules)) {\n // Rolldown also records wholly tree-shaken modules with zero bytes.\n if (module.renderedLength > 0) renderedIds.push(id)\n }\n }\n if (!renderedIds.some((id) => inside(modulePath(id), uiSourceRoot)))\n this.error(`[${label}] the bundle rendered no shared UI source modules`)\n const missing = missingRenderedUiSources(renderedIds, generatedFiles, uiRoot)\n if (missing.length)\n this.error(\n `[${label}] Tailwind source discovery missed rendered shared UI modules:\\n${missing.map((path) => `- ${path}`).join('\\n')}`\n )\n },\n }\n}\n\nfunction packageRelativePaths(files: string[], uiRoot: string): string[] {\n return files.map((file) => relative(uiRoot, file).replaceAll('\\\\', '/')).toSorted()\n}\n"],"mappings":";;;;;AA+DA,IAAM,eAAe;AAErB,SAAS,WAAW,IAAoB;CACtC,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,CAAC,MAAM;CACzC,MAAM,WAAW,QAAQ,YAAY;CACrC,IAAI;EACF,OAAO,aAAa,QAAQ;CAC9B,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,OAAO,MAAc,MAAuB;CACnD,MAAM,eAAe,SAAS,MAAM,IAAI;CACxC,OACE,iBAAiB,MAChB,iBAAiB,QAAQ,CAAC,aAAa,WAAW,KAAK,KAAK,KAAK,CAAC,WAAW,YAAY;AAE9F;AAEA,SAAS,sBACP,MACA,gBACA,qBAAwC,CAAC,GAChC;CACT,IAAI,mBAAmB,MAAM,SAAS,OAAO,MAAM,IAAI,CAAC,GAAG,OAAO;CAClE,IAAI,CAAC,OAAO,MAAM,cAAc,GAAG,OAAO;CAC1C,MAAM,WAAW,SAAS,gBAAgB,IAAI,CAAC,CAAC,MAAM,GAAG;CACzD,QACG,SAAS,OAAO,UAAU,SAAS,OAAO,eAC3C,SAAS,SAAS,KAAK,KACvB,CAAC,SAAS,SAAS,cAAc;AAErC;AAEA,SAAS,WAAW,MAAuB;CACzC,OAAO;EAAC;EAAO;EAAQ;EAAQ;EAAQ;EAAO;EAAQ;EAAQ;CAAM,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC;AAC9F;AAEA,SAAS,WAAW,MAAc,OAAgD;CAChF,MAAM,OAAO,WAAW,IAAI;CAC5B,MAAM,SAAS,MAAM,IAAI,IAAI;CAC7B,IAAI,QAAQ,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AAI,MAAM,kDAAkD;GACzE,MAAM,UAAU,yBAAyB,aAAa,gBAAgB,MAAM;GAC5E,IAAI,QAAQ,QACV,KAAK,MACH,IAAI,MAAM,kEAAkE,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,KAAK,IAAI,GAC1H;EACJ;CACF;AACF;AAEA,SAAS,qBAAqB,OAAiB,QAA0B;CACvE,OAAO,MAAM,KAAK,SAAS,SAAS,QAAQ,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS;AACpF"}
1
+ {"version":3,"file":"tailwind-sources.js","names":[],"sources":["../../src/vite/tailwind-sources.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n realpathSync,\n symlinkSync,\n writeFileSync,\n} from 'node:fs'\nimport { basename, dirname, extname, isAbsolute, relative, resolve, sep } from 'node:path'\nimport {\n defaultExport,\n directRuntimeExports,\n runtimeReexports,\n dynamicRuntimeImports,\n hasRuntimeDeclaration,\n parseSource,\n type SyntaxNode,\n selectNamespace,\n staticRuntimeImports,\n} from './source-parser'\n\nimport { normalizePath, type Plugin, type ResolvedConfig } from 'vite'\n\nexport type Selection =\n | { kind: 'execute' | 'side-effect' | 'all' }\n | { kind: 'named'; names: string[] }\n\ninterface RuntimeImport {\n specifier: string\n selection: Selection\n}\n\ninterface ExportTarget {\n file: string\n selection: Selection\n}\n\ninterface ParsedModule {\n file: string\n syntax: SyntaxNode\n}\n\nexport interface SourceDiscoveryOptions {\n entrypoint: string | string[]\n repositoryRoot: string\n uiPackageRoot: string\n uiSourceRoot: string\n /** Source roots of installed packages (such as the app framework) whose shared views render UI modules. */\n sourcePackageRoots?: string[]\n resolveId(specifier: string, importer: string): Promise<string | undefined>\n /** Error-message prefix naming the consumer. */\n label?: string\n}\n\nexport interface SourceDirectiveOptions {\n files: string[]\n uiPackageRoot: string\n stablePackagePath: string\n stylesheetPath: string\n label?: string\n}\n\nconst defaultLabel = 'ui-tailwind-sources'\n\n/**\n * One walk's memo: the same files are reached, resolved and parsed many times in a walk, and the\n * checks the plugin runs walk the same graph again. It lives in the walk's async context, so a\n * nested walk (the check inside a generation) shares it, while an independent walk that overlaps\n * it (a hot update, or a second call after a file changed) starts with its own, and a later walk\n * never reads an earlier answer.\n */\ninterface WalkMemo {\n realpaths: Map<string, string>\n modules: Map<string, ParsedModule>\n}\nconst walkMemoStore = new AsyncLocalStorage<WalkMemo>()\nconst currentWalkMemo = (): WalkMemo | undefined => walkMemoStore.getStore()\n\nfunction withWalkMemo<T>(walk: () => Promise<T>): Promise<T> {\n if (currentWalkMemo()) return walk()\n return walkMemoStore.run({ realpaths: new Map(), modules: new Map() }, walk)\n}\n\nfunction modulePath(id: string): string {\n const withoutQuery = id.split('?')[0] ?? id\n const absolute = resolve(withoutQuery)\n const known = currentWalkMemo()?.realpaths.get(absolute)\n if (known) return known\n let file = absolute\n try {\n file = realpathSync(absolute)\n } catch {\n // A path that does not exist (yet) stands for itself.\n }\n currentWalkMemo()?.realpaths.set(absolute, file)\n return file\n}\n\nfunction inside(path: string, root: string): boolean {\n const pathFromRoot = relative(root, path)\n return (\n pathFromRoot === '' ||\n (pathFromRoot !== '..' && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot))\n )\n}\n\nfunction isWorkspaceSourceFile(\n path: string,\n repositoryRoot: string,\n sourcePackageRoots: readonly string[] = []\n): boolean {\n if (sourcePackageRoots.some((root) => inside(path, root))) return true\n if (!inside(path, repositoryRoot)) return false\n const segments = relative(repositoryRoot, path).split(sep)\n return (\n (segments[0] === 'apps' || segments[0] === 'packages') &&\n segments.includes('src') &&\n !segments.includes('node_modules')\n )\n}\n\nfunction isCodeFile(path: string): boolean {\n return ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'].includes(extname(path))\n}\n\nfunction readModule(path: string, cache: Map<string, ParsedModule>): ParsedModule {\n const file = modulePath(path)\n const cached = cache.get(file)\n if (cached) return cached\n const source = readFileSync(file, 'utf8')\n const parsed: ParsedModule = { file, syntax: parseSource(file, source) }\n cache.set(file, parsed)\n return parsed\n}\n\n// A module's runtime imports depend only on its parsed source, and a walk asks for them each time\n// it reaches the module with another selection.\nconst runtimeImportsByModule = new WeakMap<ParsedModule, RuntimeImport[]>()\n\nfunction runtimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {\n const known = runtimeImportsByModule.get(parsed)\n if (known) return known\n const imports = moduleRuntimeImports(parsed, label)\n runtimeImportsByModule.set(parsed, imports)\n return imports\n}\n\nfunction moduleRuntimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {\n const imports: RuntimeImport[] = []\n\n for (const entry of staticRuntimeImports(parsed.syntax)) {\n if (entry.kind === 'side-effect') {\n imports.push({\n specifier: entry.specifier,\n selection: { kind: 'side-effect' },\n })\n continue\n }\n const namespace = entry.bindings.find((binding) => binding.imported === '*')\n if (namespace) {\n const selection = selectNamespace(parsed.syntax, namespace.local)\n if (selection) imports.push({ specifier: entry.specifier, selection })\n } else {\n imports.push({\n specifier: entry.specifier,\n selection: {\n kind: 'named',\n names: [...new Set(entry.bindings.map((binding) => binding.imported))].toSorted(),\n },\n })\n }\n }\n\n imports.push(...dynamicRuntimeImports(parsed.syntax, parsed.file, label))\n return imports\n}\n\nfunction localRuntimeBinding(\n file: string,\n localName: string,\n cache: Map<string, ParsedModule>\n): RuntimeImport | undefined {\n const parsed = readModule(file, cache)\n for (const entry of staticRuntimeImports(parsed.syntax)) {\n const binding = entry.bindings.find((candidate) => candidate.local === localName)\n if (binding)\n return {\n specifier: entry.specifier,\n selection:\n binding.imported === '*' ? { kind: 'all' } : { kind: 'named', names: [binding.imported] },\n }\n }\n return undefined\n}\n\nfunction hasLocalRuntimeBinding(\n file: string,\n localName: string,\n cache: Map<string, ParsedModule>\n): boolean {\n return hasRuntimeDeclaration(readModule(file, cache).syntax, localName)\n}\n\nfunction modifierExport(file: string, name: string, cache: Map<string, ParsedModule>): boolean {\n return directRuntimeExports(readModule(file, cache).syntax).includes(name)\n}\n\nexport function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {\n return withWalkMemo(() => walkUiSourceFiles(options))\n}\n\nasync function walkUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {\n const label = options.label ?? defaultLabel\n const repositoryRoot = realpathSync(options.repositoryRoot)\n const uiSourceRoot = realpathSync(options.uiSourceRoot)\n const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))\n const entrypoints = (\n Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]\n ).map((entrypoint) => realpathSync(entrypoint))\n const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()\n const visited = new Set<string>()\n const files = new Set<string>()\n const publishedUiResolutions: string[] = []\n\n const resolveImport = async (\n specifier: string,\n importer: string,\n selection: Selection\n ): Promise<void> => {\n const importerIsUi = inside(importer, uiSourceRoot)\n const isPublishedUiImport = specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/')\n const resolved = await options.resolveId(specifier, importer)\n if (isPublishedUiImport)\n publishedUiResolutions.push(`${specifier} -> ${resolved ?? '(unresolved)'}`)\n if (!resolved) {\n if (isPublishedUiImport || importerIsUi)\n throw new Error(\n `[${label}] unable to resolve runtime import '${specifier}' from ${importer}`\n )\n return\n }\n\n const target = modulePath(resolved)\n if (!isCodeFile(target)) return\n if (isPublishedUiImport && !inside(target, uiSourceRoot)) {\n throw new Error(`[${label}] '${specifier}' resolved outside published UI source: ${target}`)\n }\n if (\n inside(target, uiSourceRoot) ||\n isWorkspaceSourceFile(target, repositoryRoot, sourcePackageRoots)\n ) {\n await visit(target, selection)\n return\n }\n }\n\n const resolveExportTargets = async (\n file: string,\n name: string,\n chain: Set<string>\n ): Promise<ExportTarget[]> => {\n const key = `${file}\\0${name}`\n if (chain.has(key)) return []\n const nextChain = new Set(chain).add(key)\n const parsed = readModule(file, cache)\n const targets: ExportTarget[] = []\n\n if (modifierExport(file, name, cache)) targets.push({ file, selection: { kind: 'execute' } })\n\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (entry.kind === 'empty') continue\n if (entry.kind === 'named' && !entry.source) {\n if (entry.exported !== name) continue\n const imported = localRuntimeBinding(file, entry.imported, cache)\n if (imported) {\n const resolved = await options.resolveId(imported.specifier, file)\n if (resolved)\n targets.push({\n file: modulePath(resolved),\n selection: imported.selection,\n })\n else if (inside(file, uiSourceRoot))\n throw new Error(\n `[${label}] unable to resolve local re-export '${imported.specifier}' from ${file}`\n )\n } else if (hasLocalRuntimeBinding(file, entry.imported, cache))\n targets.push({ file, selection: { kind: 'execute' } })\n continue\n }\n if (\n !entry.source ||\n (entry.kind !== 'star' && entry.exported !== name) ||\n (entry.kind === 'star' && name === 'default')\n )\n continue\n if (entry.source === 'lucide-solid') {\n targets.push({ file, selection: { kind: 'execute' } })\n continue\n }\n const resolved = await options.resolveId(entry.source, file)\n if (!resolved) {\n if (inside(file, uiSourceRoot) && entry.kind !== 'namespace')\n throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)\n continue\n }\n if (entry.kind === 'star')\n targets.push(...(await resolveExportTargets(modulePath(resolved), name, nextChain)))\n else if (entry.kind === 'namespace')\n targets.push({\n file: modulePath(resolved),\n selection: { kind: 'all' },\n })\n else\n targets.push({\n file: modulePath(resolved),\n selection: { kind: 'named', names: [entry.imported] },\n })\n }\n if (name === 'default') {\n const entry = defaultExport(parsed.syntax)\n if (entry?.kind === 'identifier') {\n const imported = localRuntimeBinding(file, entry.name, cache)\n if (imported) {\n const resolved = await options.resolveId(imported.specifier, file)\n if (resolved)\n targets.push({\n file: modulePath(resolved),\n selection: imported.selection,\n })\n } else targets.push({ file, selection: { kind: 'execute' } })\n } else if (entry) targets.push({ file, selection: { kind: 'execute' } })\n }\n\n return deduplicateTargets(targets)\n }\n\n const runtimeExportNames = async (file: string, chain: Set<string>): Promise<string[]> => {\n if (chain.has(file)) return []\n const nextChain = new Set(chain).add(file)\n const parsed = readModule(file, cache)\n const names = new Set(directRuntimeExports(parsed.syntax))\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (!entry.source) {\n if (entry.kind === 'named') names.add(entry.exported)\n continue\n }\n if (entry.kind === 'star' && entry.source === 'lucide-solid') continue\n const resolved = await options.resolveId(entry.source, file)\n if (!resolved) {\n if (inside(file, uiSourceRoot))\n throw new Error(`[${label}] unable to resolve re-export '${entry.source}' from ${file}`)\n continue\n }\n if (entry.kind === 'named' || entry.kind === 'namespace') names.add(entry.exported)\n else if (entry.kind === 'star')\n for (const name of await runtimeExportNames(modulePath(resolved), nextChain))\n if (name !== 'default') names.add(name)\n }\n return [...names].toSorted()\n }\n\n const visit = async (path: string, selection: Selection): Promise<void> => {\n const file = modulePath(path)\n if (!isCodeFile(file)) return\n if (\n !inside(file, uiSourceRoot) &&\n !isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots)\n )\n return\n const key = `${file}\\0${selection.kind === 'named' ? selection.names.join(',') : selection.kind}`\n if (visited.has(key)) return\n visited.add(key)\n const parsed = readModule(file, cache)\n const isUiSource = inside(file, uiSourceRoot)\n if (isUiSource) files.add(file)\n\n const moduleImports = runtimeImports(parsed, label)\n // Follow all runtime imports of every visited module. Even when a module\n // is reached through a side-effect import, its own imports may execute\n // setup code or register UI components needed by the consumer.\n for (const dependency of moduleImports) {\n await resolveImport(dependency.specifier, file, dependency.selection)\n }\n\n if (selection.kind === 'execute' || selection.kind === 'side-effect') return\n const names =\n selection.kind === 'named' ? selection.names : await runtimeExportNames(file, new Set())\n for (const name of names) {\n const targets = await resolveExportTargets(file, name, new Set())\n if (!targets.length) {\n throw new Error(`[${label}] unable to resolve runtime export '${name}' from ${file}`)\n }\n for (const target of targets) await visit(target.file, target.selection)\n }\n }\n\n for (const entrypoint of entrypoints) await visit(entrypoint, { kind: 'execute' })\n if (files.size === 0)\n throw new Error(\n `[${label}] the client import graph resolved no shared UI source files from ${entrypoints.join(', ')}; package imports: ${publishedUiResolutions.slice(0, 8).join('; ') || '(none)'}`\n )\n return [...files].toSorted()\n}\n\nfunction deduplicateTargets(targets: ExportTarget[]): ExportTarget[] {\n const unique = new Map<string, ExportTarget>()\n for (const target of targets) {\n const key = `${target.file}\\0${target.selection.kind === 'named' ? target.selection.names.join(',') : target.selection.kind}`\n unique.set(key, target)\n }\n return [...unique.values()]\n}\n\nfunction filesBelow(directory: string): string[] {\n return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {\n const path = resolve(directory, entry.name)\n if (entry.isDirectory()) return filesBelow(path)\n return entry.isFile() ? [path] : []\n })\n}\n\n/**\n * Tailwind's scanner widens a file `@source` to that file's whole directory\n * tree, so a reached `button/button.tsx` would also pull in an unused sibling\n * (and a reached package-root barrel would pull in every component). Negate\n * every file in those trees the import graph did not reach to keep discovery\n * exact to the module.\n */\nexport function formatUiSourceDirectives(options: SourceDirectiveOptions): string {\n const label = options.label ?? defaultLabel\n const packageRoot = realpathSync(options.uiPackageRoot)\n const stylesheetDirectory = dirname(resolve(options.stylesheetPath))\n const directive = (file: string, negated: boolean) => {\n if (!inside(file, packageRoot))\n throw new Error(`[${label}] source is outside published package: ${file}`)\n const stableFile = resolve(options.stablePackagePath, relative(packageRoot, file))\n const relativePath = relative(stylesheetDirectory, stableFile).replaceAll('\\\\', '/')\n if (isAbsolute(relativePath))\n throw new Error(`[${label}] generated source path is not portable: ${relativePath}`)\n return `@source ${negated ? 'not ' : ''}'${relativePath}';`\n }\n const included = [...new Set(options.files.map((path) => realpathSync(path)))].toSorted()\n const includedSet = new Set(included)\n const scannedTrees = [...new Set(included.map((file) => dirname(file)))]\n .toSorted()\n .filter((directory, index, all) => !all.slice(0, index).some((root) => inside(directory, root)))\n const excluded = scannedTrees\n .flatMap((directory) => filesBelow(directory))\n .filter((file) => !includedSet.has(file))\n .toSorted()\n return `${[\n ...included.map((file) => directive(file, false)),\n ...excluded.map((file) => directive(file, true)),\n ].join('\\n')}\\n`\n}\n\n/**\n * The rendered shared UI source modules (by package-relative path) that the\n * generated directives do not cover. Ids may carry Vite query suffixes.\n */\nexport function missingRenderedUiSources(\n renderedIds: string[],\n generatedFiles: string[],\n uiRoot: string\n): string[] {\n const uiSourceRoot = resolve(uiRoot, 'src')\n const generated = new Set(generatedFiles.map((file) => modulePath(file)))\n return [\n ...new Set(\n renderedIds\n .map((id) => modulePath(id))\n .filter((file) => isCodeFile(file) && inside(file, uiSourceRoot) && !generated.has(file))\n .map((file) => relative(uiRoot, file).replaceAll('\\\\', '/'))\n ),\n ].toSorted()\n}\n\nfunction writeIfChanged(path: string, content: string) {\n let current: string | undefined\n try {\n current = readFileSync(path, 'utf8')\n } catch {\n // The first invocation creates the ignored generated file.\n }\n if (current === content) return\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, content)\n}\n\n/**\n * The framework package's published `src` directory holding `file`: the\n * nearest `src` ancestor whose parent is the @adea-ai/app-framework package.\n * Its views live in subdirectories (`src/views`) and import across `src`.\n */\nfunction frameworkSourceRoot(file: string): string {\n for (\n let directory = dirname(file);\n dirname(directory) !== directory;\n directory = dirname(directory)\n ) {\n if (basename(directory) !== 'src') continue\n try {\n const manifest = JSON.parse(readFileSync(resolve(directory, '../package.json'), 'utf8')) as {\n name?: unknown\n }\n if (manifest.name === '@adea-ai/app-framework') return directory\n } catch {\n // Not the package root; keep walking up.\n }\n }\n return dirname(file)\n}\n\n/**\n * The framework's shared views (Help Center and friends) import shared UI\n * modules from its published source, so its graph counts as the app's.\n */\nexport async function frameworkSourceRoots(\n resolveId: (specifier: string, importer: string) => Promise<string | undefined>,\n entrypoint: string,\n label = defaultLabel\n): Promise<string[]> {\n const framework = await resolveId('@adea-ai/app-framework/app-help', entrypoint)\n if (!framework) return []\n const root = frameworkSourceRoot(realpathSync(modulePath(framework)))\n if (basename(root) !== 'src')\n throw new Error(\n `[${label}] @adea-ai/app-framework resolved outside its published source: ${root}`\n )\n return [root]\n}\n\nexport interface LinkedImport {\n /** The shared UI source module that imports or re-exports the specifier. */\n file: string\n selection: Selection\n}\n\nexport interface LinkedImportOptions {\n entrypoint: string | string[]\n repositoryRoot: string\n uiSourceRoot: string\n sourcePackageRoots?: string[]\n /** The external package whose uses inside shared UI source are reported. */\n specifier: string\n resolveId(specifier: string, importer: string): Promise<string | undefined>\n label?: string\n}\n\n/**\n * Every use of `specifier` inside shared UI source the dev server links.\n *\n * Vite serves the published package as native ESM, so static imports and\n * re-exports are linked even when the consumer selects one root-barrel name,\n * unlike the selective walk the Tailwind sources come from. Literal dynamic\n * imports are included without executing them, so a lazy feature cannot fail\n * later on an import the check never saw.\n */\nexport function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {\n return withWalkMemo(() => walkLinkedImports(options))\n}\n\nasync function walkLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {\n const label = options.label ?? defaultLabel\n const repositoryRoot = realpathSync(options.repositoryRoot)\n const uiSourceRoot = realpathSync(options.uiSourceRoot)\n const sourcePackageRoots = (options.sourcePackageRoots ?? []).map((root) => realpathSync(root))\n const entrypoints = (\n Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]\n ).map((entrypoint) => realpathSync(entrypoint))\n const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()\n const visited = new Set<string>()\n const linked: LinkedImport[] = []\n const reached = (file: string) =>\n isCodeFile(file) &&\n (inside(file, uiSourceRoot) || isWorkspaceSourceFile(file, repositoryRoot, sourcePackageRoots))\n\n const visit = async (path: string): Promise<void> => {\n const file = modulePath(path)\n if (!reached(file) || visited.has(file)) return\n visited.add(file)\n const inUi = inside(file, uiSourceRoot)\n const parsed = readModule(file, cache)\n const record = (selection: Selection) => {\n if (inUi) linked.push({ file, selection })\n }\n const follow = async (specifier: string, kind: string): Promise<void> => {\n const resolved = await options.resolveId(specifier, file)\n if (!resolved) {\n if (inUi || specifier === '@adea-ai/ui' || specifier.startsWith('@adea-ai/ui/'))\n throw new Error(`[${label}] unable to resolve ${kind} '${specifier}' from ${file}`)\n return\n }\n await visit(resolved)\n }\n\n for (const dependency of runtimeImports(parsed, label)) {\n if (dependency.specifier === options.specifier) record(dependency.selection)\n else await follow(dependency.specifier, 'runtime import')\n }\n for (const entry of runtimeReexports(parsed.syntax)) {\n if (!entry.source) continue\n if (entry.source !== options.specifier) await follow(entry.source, 're-export')\n else if (entry.kind === 'named') record({ kind: 'named', names: [entry.imported] })\n else if (entry.kind === 'empty') record({ kind: 'named', names: [] })\n else record({ kind: 'all' })\n }\n }\n\n for (const entrypoint of entrypoints) await visit(entrypoint)\n return linked\n}\n\nexport interface GraphCheckContext {\n command: ResolvedConfig['command']\n repositoryRoot: string\n /** The shared UI source modules the client graph reaches. */\n files: string[]\n /** Uses of an external package inside the shared UI source the dev server links. */\n linkedImports(specifier: string): Promise<LinkedImport[]>\n}\n\nexport interface TailwindSourcesOptions {\n /** Names the plugin, its errors and the generated `<name>-ui-tailwind-sources` cache files. */\n name: string\n /** The Vite root of the consuming app. */\n webRoot: string\n /** Client entry modules, relative to `webRoot`. */\n entrypoints: string[]\n /** The stylesheet that imports the generated directives, relative to `webRoot`. */\n styleEntry: string\n /** The monorepo root whose `apps/*` and `packages/*` sources count as the app's. Defaults to `webRoot/../..`. */\n repositoryRoot?: string\n /** More paths the dev server watches, relative to `webRoot`. */\n watch?: string[]\n /** Runs after each generation, in dev and in builds, to enforce app-specific graph rules. */\n check?(context: GraphCheckContext): void | Promise<void>\n}\n\nexport interface UiSourcePaths {\n entrypoints: string[]\n repositoryRoot: string\n stablePackagePath: string\n stylesheetPath: string\n manifestPath: string\n styleEntry: string\n}\n\n// The generated directives live in the ignored Vite cache next to the stable\n// package link they reference, so every path in them stays checkout-relative.\nexport function uiSourcePaths(options: TailwindSourcesOptions): UiSourcePaths {\n const { webRoot, name } = options\n return {\n entrypoints: options.entrypoints.map((entrypoint) => resolve(webRoot, entrypoint)),\n repositoryRoot: resolve(webRoot, options.repositoryRoot ?? '../..'),\n stablePackagePath: resolve(webRoot, 'node_modules/@adea-ai/ui'),\n stylesheetPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.css`),\n manifestPath: resolve(webRoot, `node_modules/.cache/${name}-ui-tailwind-sources.json`),\n styleEntry: resolve(webRoot, options.styleEntry),\n }\n}\n\ntype Resolver = (specifier: string, importer: string) => Promise<string | undefined>\n\nfunction viteResolver(config: ResolvedConfig): Resolver {\n const resolver = config.createResolver()\n return (specifier, importer) => resolver(specifier, importer, false, false)\n}\n\n/**\n * Generate Tailwind `@source` directives for exactly the published shared UI\n * modules the app's client graph reaches (static, re-exported and literal lazy\n * imports), instead of scanning every component the package ships. The client\n * build then fails if Rolldown rendered a shared UI module the directives\n * missed, so a discovery gap can never ship unstyled.\n */\nexport function tailwindSources(options: TailwindSourcesOptions): Plugin {\n const label = `${options.name}-ui-tailwind-sources`\n const paths = uiSourcePaths(options)\n let uiRoot = ''\n let uiSourceRoot = ''\n let sourcePackageRoots: string[] = []\n let repositoryRoot = ''\n let generatedFiles: string[] = []\n\n // The discovery walk and the consumer's check share one memo, and each (specifier, importer)\n // pair is resolved once per generation.\n const generate = (uncachedResolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {\n const resolutions = new Map<string, Promise<string | undefined>>()\n const resolveId: Resolver = (specifier, importer) => {\n const key = `${specifier}\\0${importer}`\n let resolved = resolutions.get(key)\n if (!resolved) {\n resolved = uncachedResolveId(specifier, importer)\n resolutions.set(key, resolved)\n }\n return resolved\n }\n return withWalkMemo(() => generateWith(resolveId, config))\n }\n const generateWith = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {\n const files = await collectUiSourceFiles({\n entrypoint: paths.entrypoints,\n repositoryRoot,\n uiPackageRoot: uiRoot,\n uiSourceRoot,\n sourcePackageRoots,\n resolveId,\n label,\n })\n await options.check?.({\n command: config.command,\n repositoryRoot,\n files,\n linkedImports: (specifier) =>\n collectLinkedImports({\n entrypoint: paths.entrypoints,\n repositoryRoot,\n uiSourceRoot,\n sourcePackageRoots,\n specifier,\n resolveId,\n label,\n }),\n })\n writeIfChanged(\n paths.stylesheetPath,\n formatUiSourceDirectives({\n files,\n uiPackageRoot: uiRoot,\n stablePackagePath: paths.stablePackagePath,\n stylesheetPath: paths.stylesheetPath,\n label,\n })\n )\n writeIfChanged(\n paths.manifestPath,\n `${JSON.stringify(packageRelativePaths(files, uiRoot), null, 2)}\\n`\n )\n return files\n }\n\n return {\n name: label,\n enforce: 'pre',\n async configResolved(config) {\n repositoryRoot = realpathSync(paths.repositoryRoot)\n const resolveId = viteResolver(config)\n const entrypoint = paths.entrypoints[0]\n if (!entrypoint) throw new Error(`[${label}] no client entrypoints`)\n const manifest = await resolveId('@adea-ai/ui/package.json', entrypoint)\n if (!manifest) throw new Error(`[${label}] unable to resolve @adea-ai/ui/package.json`)\n uiRoot = realpathSync(dirname(modulePath(manifest)))\n uiSourceRoot = realpathSync(resolve(uiRoot, 'src'))\n sourcePackageRoots = await frameworkSourceRoots(resolveId, entrypoint, label)\n // Bun links the package here; a hoisted install may not, while the\n // generated directives reference the package through this stable path.\n if (!existsSync(paths.stablePackagePath)) {\n mkdirSync(dirname(paths.stablePackagePath), { recursive: true })\n symlinkSync(uiRoot, paths.stablePackagePath, 'dir')\n }\n if (realpathSync(paths.stablePackagePath) !== uiRoot)\n throw new Error(\n `[${label}] stable package link ${paths.stablePackagePath} does not resolve to ${uiRoot}`\n )\n generatedFiles = await generate(resolveId, config)\n },\n configureServer(server) {\n for (const path of options.watch ?? []) server.watcher.add(resolve(options.webRoot, path))\n },\n async handleHotUpdate({ file, modules, server }) {\n if (!generatedFiles.length || !isCodeFile(file)) return\n const previous = packageRelativePaths(generatedFiles, uiRoot).join('\\n')\n generatedFiles = await generate(viteResolver(server.config), server.config)\n if (packageRelativePaths(generatedFiles, uiRoot).join('\\n') === previous) return\n // Keep lexical graph keys; aliased roots may use their physical path instead.\n const styles =\n server.moduleGraph.getModulesByFile(normalizePath(paths.styleEntry)) ??\n server.moduleGraph.getModulesByFile(normalizePath(modulePath(paths.styleEntry)))\n if (!styles) return\n for (const module of styles) server.moduleGraph.invalidateModule(module)\n // Returning only the stylesheet would drop the edited module from the\n // update list, so keep the modules Vite already selected for the file.\n return [...new Set([...modules, ...styles])]\n },\n generateBundle(_options, bundle) {\n // Server bundles render shared UI the client never ships; Tailwind only\n // styles the client.\n const environment = (this as { environment?: { config: { consumer?: string } } }).environment\n if (environment && environment.config.consumer !== 'client') return\n const renderedIds: string[] = []\n for (const output of Object.values(bundle)) {\n if (output.type !== 'chunk') continue\n for (const [id, module] of Object.entries(output.modules)) {\n // Rolldown also records wholly tree-shaken modules with zero bytes.\n if (module.renderedLength > 0) renderedIds.push(id)\n }\n }\n if (!renderedIds.some((id) => inside(modulePath(id), uiSourceRoot)))\n this.error(`[${label}] the bundle rendered no shared UI source modules`)\n const missing = missingRenderedUiSources(renderedIds, generatedFiles, uiRoot)\n if (missing.length)\n this.error(\n `[${label}] Tailwind source discovery missed rendered shared UI modules:\\n${missing.map((path) => `- ${path}`).join('\\n')}`\n )\n },\n }\n}\n\nfunction packageRelativePaths(files: string[], uiRoot: string): string[] {\n return files.map((file) => relative(uiRoot, file).replaceAll('\\\\', '/')).toSorted()\n}\n"],"mappings":";;;;;;AAgEA,IAAM,eAAe;AAarB,IAAM,gBAAgB,IAAI,kBAA4B;AACtD,IAAM,wBAA8C,cAAc,SAAS;AAE3E,SAAS,aAAgB,MAAoC;CAC3D,IAAI,gBAAgB,GAAG,OAAO,KAAK;CACnC,OAAO,cAAc,IAAI;EAAE,2BAAW,IAAI,IAAI;EAAG,yBAAS,IAAI,IAAI;CAAE,GAAG,IAAI;AAC7E;AAEA,SAAS,WAAW,IAAoB;CACtC,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,CAAC,MAAM;CACzC,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,QAAQ,gBAAgB,CAAC,EAAE,UAAU,IAAI,QAAQ;CACvD,IAAI,OAAO,OAAO;CAClB,IAAI,OAAO;CACX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A,eAAe,UAAU,QAAQ;GAG/B,MAAM,cAAe,KAA6D;GAClF,IAAI,eAAe,YAAY,OAAO,aAAa,UAAU;GAC7D,MAAM,cAAwB,CAAC;GAC/B,KAAK,MAAM,UAAU,OAAO,OAAO,MAAM,GAAG;IAC1C,IAAI,OAAO,SAAS,SAAS;IAC7B,KAAK,MAAM,CAAC,IAAI,WAAW,OAAO,QAAQ,OAAO,OAAO,GAEtD,IAAI,OAAO,iBAAiB,GAAG,YAAY,KAAK,EAAE;GAEtD;GACA,IAAI,CAAC,YAAY,MAAM,OAAO,OAAO,WAAW,EAAE,GAAG,YAAY,CAAC,GAChE,KAAK,MAAM,IAAI,MAAM,kDAAkD;GACzE,MAAM,UAAU,yBAAyB,aAAa,gBAAgB,MAAM;GAC5E,IAAI,QAAQ,QACV,KAAK,MACH,IAAI,MAAM,kEAAkE,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,KAAK,IAAI,GAC1H;EACJ;CACF;AACF;AAEA,SAAS,qBAAqB,OAAiB,QAA0B;CACvE,OAAO,MAAM,KAAK,SAAS,SAAS,QAAQ,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS;AACpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.152.1",
3
+ "version": "0.152.2",
4
4
  "description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -110,7 +110,7 @@ export function AboutDialog(props: AboutDialogProps) {
110
110
  variant="outline"
111
111
  size="sm"
112
112
  busy={copying()}
113
- tooltip="Copy the app version and runtime details for a support report."
113
+ tooltip="Copy version details"
114
114
  onClick={() => void copy()}
115
115
  >
116
116
  {copied() ? 'Copied' : 'Copy version info'}
@@ -123,7 +123,7 @@ export function AboutDialog(props: AboutDialogProps) {
123
123
  href={props.sourceUrl}
124
124
  target="_blank"
125
125
  rel="noopener noreferrer"
126
- tooltip={`Open the ${props.appName} source repository in your browser.`}
126
+ tooltip={`Open the ${props.appName} repository`}
127
127
  onClick={(event) => {
128
128
  if (props.openExternal) setError('')
129
129
  source.onClick(props.sourceUrl)(event)
@@ -71,15 +71,15 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
71
71
  if (props.draft.accent === THEME_DEFAULT_ID)
72
72
  return "Theme default · Uses the palette's intended color."
73
73
  const preset = props.accentOptions.find((option) => option.id === props.draft.accent)
74
- if (preset) return `${preset.label} · Controls, glyphs, selections, code, and activity.`
75
- if (custom()) return 'Custom · Controls, glyphs, selections, code, and activity.'
74
+ if (preset) return `${preset.label} · Controls, selections and code.`
75
+ if (custom()) return 'Custom · Controls, selections and code.'
76
76
  const offered = props.themeAccentOptions?.find((option) => option.id === props.draft.accent)
77
77
  // A stored theme accent survives a theme switch by id; when the new pair
78
78
  // cannot offer that slot the host falls back to the theme's own primary,
79
79
  // and the description says so rather than naming a colour not on screen.
80
80
  return offered
81
- ? `Theme ${offered.label.toLowerCase()} · The theme's own color, on controls and activity.`
82
- : "Theme default · This theme does not carry that accent, so it uses the palette's intended color."
81
+ ? `Theme ${offered.label.toLowerCase()} · The theme’s own color.`
82
+ : 'Theme default · This theme has no such accent.'
83
83
  }
84
84
  const glassDescription = () =>
85
85
  props.draft.surface === 'opaque'
@@ -496,8 +496,8 @@ export function Terminal(props: TerminalProps) {
496
496
  <Show when={lineWindow().evicted > 0}>
497
497
  {' '}
498
498
  {lineWindow().lost
499
- ? `The lines you were reading were discarded to keep memory bounded; showing the oldest ${lineWindow().end.toLocaleString()} still kept.`
500
- : `${lineWindow().evicted.toLocaleString()} of the lines you were reading were discarded to keep memory bounded.`}
499
+ ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`
500
+ : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}
501
501
  </Show>
502
502
  </span>
503
503
  <Show when={lineWindow().revealable > 0}>
@@ -13,9 +13,9 @@ const CHANNEL_OPTIONS: ReadonlyArray<{ value: UpdateChannel; label: string }> =
13
13
  ]
14
14
 
15
15
  const CHANNEL_DESCRIPTIONS: Record<UpdateChannel, string> = {
16
- stable: 'Tested releases after about four days in pre-release.',
17
- 'pre-release': 'Daily pre-release builds arrive early, with rough edges included.',
18
- dev: 'Follows every dev build from main. Intended for development machines.',
16
+ stable: 'Tested releases, after four days in pre-release.',
17
+ 'pre-release': 'Daily builds. Early, with rough edges.',
18
+ dev: 'Every build from main. For development machines.',
19
19
  }
20
20
 
21
21
  export type UpdateChannelControlProps = {
@@ -559,7 +559,7 @@ export function UpdateDialog(props: UpdateDialogProps) {
559
559
  : desktop()
560
560
  ? 'Check the release channel for the latest signed build.'
561
561
  : (local.desktopOnlyMessage ??
562
- `Open this dialog inside the desktop app to check for updates.`)
562
+ `Check for updates in the desktop app.`)
563
563
  }
564
564
  >
565
565
  {`A newer release, v${state()?.availableVersion}, is ready.`}
@@ -575,7 +575,7 @@ export function UpdateDialog(props: UpdateDialogProps) {
575
575
  type="button"
576
576
  variant="outline"
577
577
  size="sm"
578
- tooltip="Check the release channel for the latest signed app version."
578
+ tooltip="Check for a newer version"
579
579
  disabled={!desktop() || working()}
580
580
  onClick={() => void check()}
581
581
  >
@@ -748,9 +748,7 @@ export function UpdateDialog(props: UpdateDialogProps) {
748
748
  v{installedVersion(state(), local.fallbackVersion)}
749
749
  </Badge>
750
750
  </div>
751
- <p class="text-xs text-muted-foreground">
752
- All versions and updates included with this installation.
753
- </p>
751
+ <p class="text-xs text-muted-foreground">Versions included with this installation.</p>
754
752
  {/* A long text block with no focusable descendant: it needs its own tab
755
753
  stop, named by the heading above it, or a keyboard user cannot
756
754
  scroll it (`scrollable-region-focusable`). */}
@@ -59,7 +59,7 @@ type ChatComposerShellProps<Extra extends object> = ChatComposerSharedProps & {
59
59
  */
60
60
  export function ChatComposerShell<Extra extends object>(props: ChatComposerShellProps<Extra>) {
61
61
  const composer = createComposerCore({
62
- failureMessage: 'Message not sent. Check your draft and retry when the connection recovers.',
62
+ failureMessage: 'Message not sent. Your draft is kept.',
63
63
  })
64
64
  const pending = composer.pending
65
65
  let field: HTMLTextAreaElement | undefined
@@ -110,8 +110,7 @@ export function MessageComposer(props: MessageComposerProps) {
110
110
  ])
111
111
 
112
112
  const composer = createComposerCore({
113
- failureMessage:
114
- 'Message not sent. Your draft is still here; retry when the connection recovers.',
113
+ failureMessage: 'Message not sent. Your draft is kept.',
115
114
  })
116
115
  const sending = composer.pending
117
116
  const descriptionId = `message-composer-help-${createUniqueId()}`
@@ -579,7 +579,7 @@ export function SplitLayout<L extends SplitLayoutLeaf>(props: SplitLayoutProps<L
579
579
  {dropLabel() ||
580
580
  (resizeController() === 'error'
581
581
  ? reloadRequired()
582
- ? 'Resize controls did not load after repeated attempts. Reloading may discard unsaved pane content.'
582
+ ? 'Resize controls didn’t load. Reloading may lose unsaved pane content.'
583
583
  : 'Resize controls did not load.'
584
584
  : '')}
585
585
  </span>
@@ -66,8 +66,7 @@ export function AppearancePanel(props: AppearancePanelProps) {
66
66
  Appearance
67
67
  </Heading>
68
68
  <p class="max-w-prose text-sm text-muted-foreground">
69
- Follow the system, or pin one. The theme below is chosen per appearance, so switching at
70
- sunset does not make you choose again.
69
+ Follow the system, or pin one. Each appearance keeps its own theme.
71
70
  </p>
72
71
  </header>
73
72
  <RadioGroup
@@ -140,8 +139,7 @@ export function AppearancePanel(props: AppearancePanelProps) {
140
139
  Fonts
141
140
  </Heading>
142
141
  <p class="max-w-prose text-sm text-muted-foreground">
143
- Choose separate families and sizes for the interface, reading, and code. Font families
144
- come from the shared catalogue and are self-hosted.
142
+ Interface, reading and code fonts.
145
143
  </p>
146
144
  </header>
147
145
  <AppearanceFontSettingsGroup
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks'
1
2
  import {
2
3
  existsSync,
3
4
  mkdirSync,
@@ -63,14 +64,38 @@ export interface SourceDirectiveOptions {
63
64
 
64
65
  const defaultLabel = 'ui-tailwind-sources'
65
66
 
67
+ /**
68
+ * One walk's memo: the same files are reached, resolved and parsed many times in a walk, and the
69
+ * checks the plugin runs walk the same graph again. It lives in the walk's async context, so a
70
+ * nested walk (the check inside a generation) shares it, while an independent walk that overlaps
71
+ * it (a hot update, or a second call after a file changed) starts with its own, and a later walk
72
+ * never reads an earlier answer.
73
+ */
74
+ interface WalkMemo {
75
+ realpaths: Map<string, string>
76
+ modules: Map<string, ParsedModule>
77
+ }
78
+ const walkMemoStore = new AsyncLocalStorage<WalkMemo>()
79
+ const currentWalkMemo = (): WalkMemo | undefined => walkMemoStore.getStore()
80
+
81
+ function withWalkMemo<T>(walk: () => Promise<T>): Promise<T> {
82
+ if (currentWalkMemo()) return walk()
83
+ return walkMemoStore.run({ realpaths: new Map(), modules: new Map() }, walk)
84
+ }
85
+
66
86
  function modulePath(id: string): string {
67
87
  const withoutQuery = id.split('?')[0] ?? id
68
88
  const absolute = resolve(withoutQuery)
89
+ const known = currentWalkMemo()?.realpaths.get(absolute)
90
+ if (known) return known
91
+ let file = absolute
69
92
  try {
70
- return realpathSync(absolute)
93
+ file = realpathSync(absolute)
71
94
  } catch {
72
- return absolute
95
+ // A path that does not exist (yet) stands for itself.
73
96
  }
97
+ currentWalkMemo()?.realpaths.set(absolute, file)
98
+ return file
74
99
  }
75
100
 
76
101
  function inside(path: string, root: string): boolean {
@@ -110,7 +135,19 @@ function readModule(path: string, cache: Map<string, ParsedModule>): ParsedModul
110
135
  return parsed
111
136
  }
112
137
 
138
+ // A module's runtime imports depend only on its parsed source, and a walk asks for them each time
139
+ // it reaches the module with another selection.
140
+ const runtimeImportsByModule = new WeakMap<ParsedModule, RuntimeImport[]>()
141
+
113
142
  function runtimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {
143
+ const known = runtimeImportsByModule.get(parsed)
144
+ if (known) return known
145
+ const imports = moduleRuntimeImports(parsed, label)
146
+ runtimeImportsByModule.set(parsed, imports)
147
+ return imports
148
+ }
149
+
150
+ function moduleRuntimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {
114
151
  const imports: RuntimeImport[] = []
115
152
 
116
153
  for (const entry of staticRuntimeImports(parsed.syntax)) {
@@ -170,7 +207,11 @@ function modifierExport(file: string, name: string, cache: Map<string, ParsedMod
170
207
  return directRuntimeExports(readModule(file, cache).syntax).includes(name)
171
208
  }
172
209
 
173
- export async function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
210
+ export function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
211
+ return withWalkMemo(() => walkUiSourceFiles(options))
212
+ }
213
+
214
+ async function walkUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
174
215
  const label = options.label ?? defaultLabel
175
216
  const repositoryRoot = realpathSync(options.repositoryRoot)
176
217
  const uiSourceRoot = realpathSync(options.uiSourceRoot)
@@ -178,7 +219,7 @@ export async function collectUiSourceFiles(options: SourceDiscoveryOptions): Pro
178
219
  const entrypoints = (
179
220
  Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
180
221
  ).map((entrypoint) => realpathSync(entrypoint))
181
- const cache = new Map<string, ParsedModule>()
222
+ const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()
182
223
  const visited = new Set<string>()
183
224
  const files = new Set<string>()
184
225
  const publishedUiResolutions: string[] = []
@@ -517,7 +558,11 @@ export interface LinkedImportOptions {
517
558
  * imports are included without executing them, so a lazy feature cannot fail
518
559
  * later on an import the check never saw.
519
560
  */
520
- export async function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
561
+ export function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
562
+ return withWalkMemo(() => walkLinkedImports(options))
563
+ }
564
+
565
+ async function walkLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
521
566
  const label = options.label ?? defaultLabel
522
567
  const repositoryRoot = realpathSync(options.repositoryRoot)
523
568
  const uiSourceRoot = realpathSync(options.uiSourceRoot)
@@ -525,7 +570,7 @@ export async function collectLinkedImports(options: LinkedImportOptions): Promis
525
570
  const entrypoints = (
526
571
  Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
527
572
  ).map((entrypoint) => realpathSync(entrypoint))
528
- const cache = new Map<string, ParsedModule>()
573
+ const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()
529
574
  const visited = new Set<string>()
530
575
  const linked: LinkedImport[] = []
531
576
  const reached = (file: string) =>
@@ -640,7 +685,22 @@ export function tailwindSources(options: TailwindSourcesOptions): Plugin {
640
685
  let repositoryRoot = ''
641
686
  let generatedFiles: string[] = []
642
687
 
643
- const generate = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
688
+ // The discovery walk and the consumer's check share one memo, and each (specifier, importer)
689
+ // pair is resolved once per generation.
690
+ const generate = (uncachedResolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
691
+ const resolutions = new Map<string, Promise<string | undefined>>()
692
+ const resolveId: Resolver = (specifier, importer) => {
693
+ const key = `${specifier}\0${importer}`
694
+ let resolved = resolutions.get(key)
695
+ if (!resolved) {
696
+ resolved = uncachedResolveId(specifier, importer)
697
+ resolutions.set(key, resolved)
698
+ }
699
+ return resolved
700
+ }
701
+ return withWalkMemo(() => generateWith(resolveId, config))
702
+ }
703
+ const generateWith = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
644
704
  const files = await collectUiSourceFiles({
645
705
  entrypoint: paths.entrypoints,
646
706
  repositoryRoot,