@astryxdesign/cli 0.7.16 → 0.7.17-canary.gb36275e

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 (239) hide show
  1. package/README.md +13 -23
  2. package/api/build/_adapter.d.mts +5 -0
  3. package/api/build/_adapter.mjs +49 -34
  4. package/api/build/blocks/blocks.d.mts +7 -5
  5. package/api/build/blocks/blocks.mjs +113 -26
  6. package/api/build/build.doc.mjs +2 -1
  7. package/api/build/kit/rank.mjs +59 -12
  8. package/api/build/kit/weights.d.mts +16 -3
  9. package/api/build/kit/weights.json +1 -1
  10. package/api/build/kit/weights.mjs +238 -31
  11. package/api/build/kit/word-model.d.mts +23 -0
  12. package/api/build/kit/word-model.mjs +46 -0
  13. package/api/build/kit/words.d.mts +42 -0
  14. package/api/build/kit/words.mjs +82 -1
  15. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  16. package/api/component/list/list.d.mts +1 -1
  17. package/api/component/list/list.mjs +46 -5
  18. package/api/discover/_adapter.d.mts +1 -1
  19. package/api/docs/_adapter.d.mts +26 -2
  20. package/api/docs/_adapter.mjs +217 -5
  21. package/api/docs/docs.d.mts +3 -0
  22. package/api/docs/docs.doc.mjs +7 -1
  23. package/api/docs/docs.mjs +12 -0
  24. package/api/docs/docs.type.d.mts +5 -0
  25. package/api/docs/docs.type.mjs +2 -0
  26. package/api/docs/node/node.mjs +1 -1
  27. package/api/doctor/_adapter.d.mts +27 -5
  28. package/api/doctor/_adapter.mjs +77 -6
  29. package/api/doctor/built-checks.mjs +38 -13
  30. package/api/doctor/doctor.d.mts +4 -3
  31. package/api/doctor/doctor.mjs +14 -7
  32. package/api/doctor/theme-checks.mjs +121 -17
  33. package/api/render/_adapter.mjs +531 -192
  34. package/api/render/render.doc.mjs +11 -3
  35. package/api/render/render.type.d.mts +30 -0
  36. package/api/render/render.type.mjs +19 -0
  37. package/api/search/ORDERING.md +1 -1
  38. package/api/search/_candidate-score.mjs +51 -32
  39. package/api/search/_fit-order.mjs +3 -3
  40. package/api/search/_result.d.mts +5 -5
  41. package/api/search/_score.d.mts +6 -1
  42. package/api/search/_score.mjs +15 -3
  43. package/api/search/search.d.mts +1 -1
  44. package/api/theme/_adapter.mjs +10 -0
  45. package/api/theme/build/build.d.mts +47 -0
  46. package/api/theme/build/build.mjs +147 -25
  47. package/api/theme/theme.type.d.mts +10 -0
  48. package/api/theme/theme.type.mjs +7 -1
  49. package/api/theme-edit/_adapter.d.mts +48 -0
  50. package/api/theme-edit/_adapter.mjs +675 -42
  51. package/api/theme-edit/_check.d.mts +28 -22
  52. package/api/theme-edit/_check.mjs +1481 -252
  53. package/api/theme-edit/_color.d.mts +9 -0
  54. package/api/theme-edit/_color.mjs +41 -1
  55. package/api/theme-edit/_compiler.mjs +9 -0
  56. package/api/theme-edit/_context.mjs +60 -3
  57. package/api/theme-edit/_css.mjs +21 -1
  58. package/api/theme-edit/_edit.d.mts +22 -0
  59. package/api/theme-edit/_edit.mjs +1196 -88
  60. package/api/theme-edit/_how-commands.d.mts +57 -0
  61. package/api/theme-edit/_how-commands.mjs +536 -1
  62. package/api/theme-edit/_how-question.d.mts +65 -0
  63. package/api/theme-edit/_how-question.mjs +4401 -225
  64. package/api/theme-edit/_how.mjs +104 -4
  65. package/api/theme-edit/_marks.d.mts +31 -5
  66. package/api/theme-edit/_marks.mjs +57 -5
  67. package/api/theme-edit/_normal.d.mts +153 -0
  68. package/api/theme-edit/_normal.mjs +661 -0
  69. package/api/theme-edit/_palette.mjs +10 -4
  70. package/api/theme-edit/_parts.d.mts +8 -0
  71. package/api/theme-edit/_parts.mjs +103 -2
  72. package/api/theme-edit/_preview-app.d.mts +7 -1
  73. package/api/theme-edit/_preview-app.mjs +205 -17
  74. package/api/theme-edit/_preview.d.mts +64 -8
  75. package/api/theme-edit/_preview.mjs +447 -89
  76. package/api/theme-edit/_settings.d.mts +176 -5
  77. package/api/theme-edit/_settings.mjs +1936 -128
  78. package/api/theme-edit/_tables.d.mts +6 -0
  79. package/api/theme-edit/_tables.mjs +32 -1
  80. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  81. package/api/theme-edit/theme-edit.type.mjs +4 -1
  82. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  83. package/assets/codemods/run-codemod.mjs +73 -6
  84. package/assets/codemods/transforms/next/index.mjs +11 -1
  85. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  86. package/assets/docs/author-a-theme.doc.mjs +1 -0
  87. package/assets/docs/theme.doc.dense.mjs +2 -2
  88. package/assets/docs/theme.doc.mjs +1 -1
  89. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  90. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  91. package/assets/docs/tree/render-pages.doc.mjs +43 -2
  92. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  93. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  94. package/assets/docs/use-a-theme.doc.mjs +1 -1
  95. package/assets/docs.generated.json +2 -2
  96. package/assets/self-audit.generated.json +1 -1
  97. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  98. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  99. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  100. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  101. package/assets/templates/components.generated.json +1 -1
  102. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  103. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  104. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  105. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  106. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  107. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  108. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  109. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  110. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  111. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  112. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  113. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  114. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  115. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  116. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  117. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  118. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  119. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  120. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  121. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  122. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  123. package/assets/templates/pages/ide/page.tsx +24 -2
  124. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  125. package/assets/templates/pages/library/template.doc.mjs +4 -1
  126. package/assets/templates/pages/login/template.doc.mjs +2 -1
  127. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  128. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  129. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  130. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  131. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  132. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  133. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  134. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  135. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  136. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  137. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  138. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  139. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  140. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  141. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  142. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  143. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  144. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  145. package/authoring/debug/parse.d.mts +3 -3
  146. package/authoring/doctypes/_schema.d.mts +3 -3
  147. package/authoring/doctypes/command/command.doc.mjs +1 -1
  148. package/authoring/doctypes/template/template.doc.mjs +1 -1
  149. package/authoring/doctypes/template/type.ts +9 -0
  150. package/clients/cli/bin/astryx.mjs +6 -9
  151. package/clients/cli/build-id.generated.json +1 -1
  152. package/clients/cli/commands/component.doc.mjs +1 -1
  153. package/clients/cli/commands/component.mjs +20 -2
  154. package/clients/cli/commands/docs.doc.mjs +7 -1
  155. package/clients/cli/commands/docs.mjs +3 -1
  156. package/clients/cli/commands/doctor.mjs +22 -14
  157. package/clients/cli/commands/experimental/render.mjs +32 -1
  158. package/clients/cli/commands/experimental/theme.mjs +65 -14
  159. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  160. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  161. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  162. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  163. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  164. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  165. package/clients/cli/commands/search.doc.mjs +2 -1
  166. package/clients/cli/commands/search.mjs +6 -1
  167. package/clients/cli/commands/template.mjs +4 -2
  168. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  169. package/clients/cli/commands/theme.doc.mjs +1 -1
  170. package/clients/cli/commands/theme.mjs +153 -5
  171. package/clients/cli/commands/upgrade.mjs +42 -7
  172. package/clients/cli/index.mjs +1 -1
  173. package/clients/cli/lib/component-format.mjs +205 -98
  174. package/clients/cli/lib/hook-format.mjs +9 -19
  175. package/clients/cli/manifest.generated.json +1 -1
  176. package/foundation/agent-docs/agent-docs.mjs +1 -1
  177. package/foundation/config/theme-state.d.mts +13 -1
  178. package/foundation/config/theme-state.mjs +47 -7
  179. package/foundation/discovery/component-discovery.d.mts +11 -0
  180. package/foundation/discovery/component-discovery.mjs +27 -2
  181. package/foundation/discovery/component-replacement.mjs +130 -1
  182. package/foundation/discovery/entry-name-files.d.mts +43 -0
  183. package/foundation/discovery/entry-name-files.mjs +264 -0
  184. package/foundation/discovery/hook-discovery.d.mts +8 -2
  185. package/foundation/discovery/hook-discovery.mjs +20 -7
  186. package/foundation/discovery/package-exports.d.mts +10 -0
  187. package/foundation/discovery/package-exports.mjs +56 -3
  188. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  189. package/foundation/discovery/runner-allowlist.mjs +2 -0
  190. package/foundation/discovery/template-adapter.d.mts +52 -0
  191. package/foundation/discovery/template-adapter.mjs +173 -10
  192. package/foundation/discovery/theme-imports.d.mts +14 -0
  193. package/foundation/discovery/theme-imports.mjs +43 -1
  194. package/foundation/doc-compiler/import.mjs +7 -1
  195. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  196. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  197. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  198. package/foundation/fs/cache-eviction.d.mts +21 -0
  199. package/foundation/fs/cache-eviction.mjs +73 -0
  200. package/foundation/fs/gather-cache.d.mts +25 -4
  201. package/foundation/fs/gather-cache.mjs +163 -53
  202. package/foundation/fs/jiti-cache.d.mts +19 -1
  203. package/foundation/fs/jiti-cache.mjs +130 -6
  204. package/foundation/fs/kept-tree.d.mts +60 -0
  205. package/foundation/fs/kept-tree.mjs +154 -0
  206. package/foundation/fs/module-loader.d.mts +18 -2
  207. package/foundation/fs/module-loader.mjs +92 -20
  208. package/foundation/identity/provider-identity.d.mts +6 -0
  209. package/foundation/identity/provider-identity.mjs +10 -1
  210. package/foundation/render/embedded-imports.d.mts +5 -4
  211. package/foundation/render/embedded-imports.mjs +7 -16
  212. package/foundation/render/file-header.d.mts +66 -0
  213. package/foundation/render/file-header.mjs +118 -0
  214. package/foundation/render/host-answer.d.mts +18 -0
  215. package/foundation/render/host-answer.mjs +46 -0
  216. package/foundation/render/host-exit.d.mts +1 -0
  217. package/foundation/render/host-exit.mjs +6 -1
  218. package/foundation/render/html-reader.d.mts +55 -2
  219. package/foundation/render/html-reader.mjs +145 -26
  220. package/foundation/render/markup-edits.d.mts +57 -0
  221. package/foundation/render/markup-edits.mjs +182 -0
  222. package/foundation/render/page-host.mjs +29 -12
  223. package/foundation/render/page-worker.mjs +83 -13
  224. package/foundation/render/render-page.d.mts +34 -2
  225. package/foundation/render/render-page.mjs +210 -29
  226. package/foundation/render/source-block.d.mts +73 -6
  227. package/foundation/render/source-block.mjs +170 -19
  228. package/foundation/render/ts-paths.d.mts +53 -6
  229. package/foundation/render/ts-paths.mjs +286 -41
  230. package/foundation/response/error-codes.d.mts +3 -1
  231. package/foundation/response/error-codes.d.ts +1 -0
  232. package/foundation/response/error-codes.doc.mjs +12 -1
  233. package/foundation/response/error-codes.mjs +10 -0
  234. package/foundation/text/string-utils.d.mts +3 -2
  235. package/foundation/text/string-utils.mjs +16 -3
  236. package/foundation/text/suggest-order.d.mts +9 -0
  237. package/foundation/text/suggest-order.mjs +13 -0
  238. package/host/index.mjs +8 -6
  239. package/package.json +6 -6
@@ -15,7 +15,8 @@
15
15
  import {createHash} from 'node:crypto';
16
16
  import * as fs from 'node:fs';
17
17
  import * as path from 'node:path';
18
- import {spawnSync} from 'node:child_process';
18
+ import {spawn} from 'node:child_process';
19
+ import * as os from 'node:os';
19
20
  import {fileURLToPath, pathToFileURL} from 'node:url';
20
21
  import {
21
22
  SAMPLE_PAGE,
@@ -32,7 +33,6 @@ import {
32
33
  } from './_parts.mjs';
33
34
  import {OVERVIEW_SECTIONS} from './_overview.mjs';
34
35
  import {
35
- FOLDER_JUNK,
36
36
  folderIsEmpty,
37
37
  camel,
38
38
  fontPackages,
@@ -1417,11 +1417,15 @@ const camelName = camel;
1417
1417
  * @param {string} html absolute
1418
1418
  * @param {string} png absolute
1419
1419
  * @param {'light' | 'dark'} mode
1420
- * @returns {Promise<{ok: true, file: string, cut?: boolean} | {ok: false, reason: string}>} `cut` when the picture is of the window, not the whole page
1420
+ * @returns {Promise<{ok: true, file: string, cut?: boolean} | {ok: false, reason: string, stopped?: string}>} `cut` when the picture is of the window, not the whole page
1421
1421
  */
1422
1422
  export async function screenshot(project, html, png, mode) {
1423
1423
  /** What was found and why it could not take the picture. @type {string[]} */
1424
1424
  const failed = [];
1425
+ /** Whether a Playwright was found without its own browser installed. */
1426
+ let pwMissing = false;
1427
+ /** Whether a Playwright was found at all. */
1428
+ let pwFound = false;
1425
1429
  /** The first line of an error, with no path of this machine. @param {unknown} e */
1426
1430
  const firstLine = e =>
1427
1431
  String(/** @type {any} */ (e)?.message ?? e ?? '')
@@ -1438,12 +1442,28 @@ export async function screenshot(project, html, png, mode) {
1438
1442
  } catch {
1439
1443
  continue;
1440
1444
  }
1445
+ pwFound = true;
1441
1446
  try {
1442
1447
  const pw = await import(pathToFileURL(entry).href);
1443
1448
  const chromium = pw.chromium ?? pw.default?.chromium;
1444
- const browser = await chromium.launch(
1445
- chromeBinary() ? {executablePath: chromeBinary()} : {},
1446
- );
1449
+ // Playwright's own browser first; the system Chrome when that one is
1450
+ // not installed or does not start.
1451
+ /** @type {any} */
1452
+ let browser;
1453
+ try {
1454
+ browser = await chromium.launch({});
1455
+ } catch (own) {
1456
+ const sys = chromeBinary();
1457
+ if (
1458
+ /Executable doesn't exist|playwright install/i.test(
1459
+ String(/** @type {any} */ (own)?.message),
1460
+ )
1461
+ )
1462
+ pwMissing = true;
1463
+ if (!sys) throw own;
1464
+ failed.push(`${pkg} with its own browser: ${firstLine(own)}`);
1465
+ browser = await chromium.launch({executablePath: sys});
1466
+ }
1447
1467
  try {
1448
1468
  const page = await browser.newPage({
1449
1469
  viewport: {width: 1280, height: 900},
@@ -1462,37 +1482,67 @@ export async function screenshot(project, html, png, mode) {
1462
1482
  }
1463
1483
  const chrome = chromeBinary();
1464
1484
  if (chrome) {
1465
- const r = spawnSync(
1466
- chrome,
1467
- [
1468
- '--headless=new',
1469
- '--disable-gpu',
1470
- '--no-sandbox',
1471
- '--hide-scrollbars',
1472
- `--screenshot=${png}`,
1473
- '--window-size=1280,2400',
1474
- ...(mode === 'dark' ? ['--force-dark-mode'] : []),
1475
- pathToFileURL(html).href,
1476
- ],
1477
- {encoding: 'utf8', timeout: 60_000},
1478
- );
1485
+ // Run without blocking, so a stop (Ctrl-C, SIGTERM) reaches this
1486
+ // process while the browser runs: the browser is stopped with it, and
1487
+ // the stop is reported as a stop, never as a browser that failed.
1488
+ const r = await runBrowser(chrome, [
1489
+ '--headless=new',
1490
+ '--disable-gpu',
1491
+ '--no-sandbox',
1492
+ '--hide-scrollbars',
1493
+ `--screenshot=${png}`,
1494
+ '--window-size=1280,2400',
1495
+ ...(mode === 'dark' ? ['--force-dark-mode'] : []),
1496
+ pathToFileURL(html).href,
1497
+ ]);
1498
+ if (r.stoppedBy)
1499
+ return {
1500
+ ok: false,
1501
+ stopped: r.stoppedBy,
1502
+ reason: `the pictures were stopped (${r.stoppedBy}) before the browser finished`,
1503
+ };
1504
+ // The editor's own bound, not an outside kill: said so, with a retry.
1505
+ if (r.timedOut)
1506
+ return {
1507
+ ok: false,
1508
+ reason: `the browser (${chrome}) did not finish the picture within 60 seconds, so it was stopped; run the command again, or open the .html beside the picture to look without one`,
1509
+ };
1510
+ // A picture folder it cannot write: the folder, never the browser.
1511
+ try {
1512
+ fs.accessSync(path.dirname(png), fs.constants.W_OK);
1513
+ } catch (e) {
1514
+ return {
1515
+ ok: false,
1516
+ reason: `${shown(project.cwd, path.dirname(png))}/ cannot be written (${/** @type {any} */ (e)?.code ?? 'no access'}), so no picture was taken; fix its permissions, then run the command again`,
1517
+ };
1518
+ }
1479
1519
  // Chrome alone takes the window, not the whole page.
1480
1520
  if (r.status === 0 && fs.existsSync(png))
1481
1521
  return {ok: true, file: shown(project.cwd, png), cut: true};
1482
1522
  failed.push(
1483
1523
  `${chrome}: ${firstLine(
1484
1524
  r.error ??
1485
- (r.stderr ||
1486
- (r.signal
1487
- ? `stopped by ${r.signal}`
1488
- : `exit ${r.status}, and no picture was written`)),
1525
+ // A browser stopped by a signal says so first: its stderr opens
1526
+ // with unrelated noise (dbus) on Linux.
1527
+ (r.signal
1528
+ ? `stopped by ${r.signal}`
1529
+ : meaningfulLine(r.stderr) ||
1530
+ `exit ${r.status}, and no picture was written`),
1489
1531
  )}`,
1490
1532
  );
1491
1533
  }
1492
1534
  if (failed.length)
1493
1535
  return {
1494
1536
  ok: false,
1495
- reason: `A browser was found, but it could not take the picture (${failed.join('; ')}). Give Playwright its browser (npx playwright install chromium), or check that ${chrome ?? 'Google Chrome or Chromium'} starts on this machine. The HTML preview needs neither.`,
1537
+ // Advice that can change the result: Playwright's browser only when
1538
+ // it is missing, else the browsers that were tried.
1539
+ reason: `A browser was found, but it could not take the picture (${failed.join('; ')}). ${
1540
+ !pwFound
1541
+ ? `Install Playwright with its browser (${installLine(project.cwd, ['playwright'])}, then npx playwright install chromium), or check`
1542
+ : pwMissing
1543
+ ? 'Give Playwright its browser (npx playwright install chromium), or check'
1544
+ : "Playwright's own browser did not start either: check"
1545
+ } that ${chrome ?? 'Google Chrome or Chromium'} starts on this machine. The HTML preview needs neither.`,
1496
1546
  };
1497
1547
  return {
1498
1548
  ok: false,
@@ -1515,11 +1565,23 @@ function chromeBinary() {
1515
1565
  'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
1516
1566
  'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
1517
1567
  ];
1518
- for (const f of fixed) if (fs.existsSync(f)) return f;
1568
+ // Only a file that runs: a folder or a file with no execute permission
1569
+ // by a browser's name is passed over, and the search goes on.
1570
+ /** @param {string} f */
1571
+ const runs = f => {
1572
+ try {
1573
+ if (!fs.statSync(f).isFile()) return false;
1574
+ if (process.platform !== 'win32') fs.accessSync(f, fs.constants.X_OK);
1575
+ return true;
1576
+ } catch {
1577
+ return false;
1578
+ }
1579
+ };
1580
+ for (const f of fixed) if (runs(f)) return f;
1519
1581
  for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
1520
1582
  for (const n of names) {
1521
1583
  const f = path.join(dir, n);
1522
- if (dir && fs.existsSync(f)) return f;
1584
+ if (dir && runs(f)) return f;
1523
1585
  }
1524
1586
  }
1525
1587
  return null;
@@ -1527,7 +1589,25 @@ function chromeBinary() {
1527
1589
 
1528
1590
  /** The first line of every file the editor writes into a theme's app copy. */
1529
1591
  export {APP_COPY_MARK} from './_marks.mjs';
1530
- import {APP_COPY_MARK} from './_marks.mjs';
1592
+ import {APP_COPY_MARK, appCopyMark} from './_marks.mjs';
1593
+ import {builtColorMode} from '../../foundation/discovery/theme-imports.mjs';
1594
+
1595
+ /**
1596
+ * The font stylesheets a theme's app copy imports, from the fonts the theme
1597
+ * loads now (an installed font package, the base theme's fonts).
1598
+ * @param {import('./_settings.mjs').Ctx} ctx
1599
+ * @param {string} slug
1600
+ * @param {import('./_settings.mjs').ThemeData} data
1601
+ * @returns {string[]}
1602
+ */
1603
+ export function copyFontsCss(ctx, slug, data) {
1604
+ return themeImports(
1605
+ ctx,
1606
+ slug,
1607
+ data,
1608
+ path.join(ctx.project.cwd, 'src', 'themes', slug),
1609
+ ).css.slice(1);
1610
+ }
1531
1611
 
1532
1612
  /**
1533
1613
  * The app's copy of an editor theme: a standard local theme in
@@ -1545,38 +1625,26 @@ import {APP_COPY_MARK} from './_marks.mjs';
1545
1625
  * @returns {string | null}
1546
1626
  */
1547
1627
  export function writeAppCopy(ctx, slug, data) {
1548
- return writeAppCopyAt(
1549
- ctx.project.cwd,
1550
- slug,
1551
- themeImports(
1552
- ctx,
1553
- slug,
1554
- data,
1555
- path.join(ctx.project.cwd, 'src', 'themes', slug),
1556
- ).css.slice(1),
1557
- );
1628
+ return writeAppCopyAt(ctx.project.cwd, slug, copyFontsCss(ctx, slug, data));
1558
1629
  }
1559
1630
 
1560
1631
  /**
1561
- * {@link writeAppCopy} with the font stylesheets given, or null to keep the
1562
- * copy's own (a compile, which changes no setting).
1632
+ * The files of a theme's app copy as the editor would write them now, by
1633
+ * name; null with no build to copy. Font stylesheets as given, or null for
1634
+ * the copy's own.
1563
1635
  * @param {string} cwd
1564
1636
  * @param {string} slug
1565
1637
  * @param {string[] | null} fontsCss
1566
- * @returns {string | null}
1638
+ * @returns {Record<string, string> | null}
1567
1639
  */
1568
- export function writeAppCopyAt(cwd, slug, fontsCss) {
1640
+ function appCopyFiles(cwd, slug, fontsCss) {
1569
1641
  const f = themeFiles(cwd, slug);
1570
1642
  const dir = path.join(cwd, 'src', 'themes', slug);
1571
1643
  const name = `${camel(slug)}Theme`;
1572
- const first = !fs.existsSync(path.join(dir, `${name}.doc.mjs`));
1573
1644
  if (!fs.existsSync(f.js) || !fs.existsSync(f.css)) return null;
1574
- // The copy's source, as the stable build's header names it.
1575
1645
  const source = `src/themes/${slug}/${name}.ts`;
1576
- // Only the editor's own copy is written over.
1577
- if (appCopyBlocker(cwd, slug) !== null) return null;
1578
1646
  const head = (/** @type {string} */ open, /** @type {string} */ close) =>
1579
- `${open} ${APP_COPY_MARK} after every build of themes/${slug}/; do not edit it here. Change the theme with the editor. ${close}\n`;
1647
+ `${open} ${appCopyMark(slug)} after every build of themes/${slug}/; do not edit it here. Change the theme with the editor. ${close}\n`;
1580
1648
  const keptFonts = path.join(dir, `${slug}.fonts.css`);
1581
1649
  const fonts =
1582
1650
  fontsCss ??
@@ -1598,27 +1666,112 @@ export function writeAppCopyAt(cwd, slug, fontsCss) {
1598
1666
  if (fs.existsSync(from))
1599
1667
  built[`${slug}${ext}`] = asBuilt(fs.readFileSync(from, 'utf8'));
1600
1668
  }
1669
+ // A light-only or dark-only theme's build exports its one color mode
1670
+ // (`colorModes`); the copy's source re-exports it, so a build of the copy
1671
+ // writes it too and `theme add` reads it.
1672
+ const oneMode = builtColorMode(f.js).mode;
1601
1673
  const files = {
1602
1674
  [`${name}.doc.mjs`]: `${head('//', '')}\n/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */\nexport default {\n type: 'theme',\n name: ${JSON.stringify(slug)},\n displayName: ${JSON.stringify(slug)},\n description: ${JSON.stringify(`The ${slug} theme, made with the theme editor (themes/${slug}/).`)},\n maintained: false,\n};\n`,
1603
- [`${name}.ts`]: `${head('//', '')}export {${name}} from './${slug}';\n`,
1675
+ [`${name}.ts`]: `${head('//', '')}export {${name}${oneMode ? ', colorModes' : ''}} from './${slug}';\n`,
1604
1676
  ...built,
1605
- ...(fonts.length
1606
- ? {
1607
- [`${slug}.fonts.css`]: `${head('/*', '*/')}${fonts.map(c => `@import ${JSON.stringify(c)};`).join('\n')}\n`,
1608
- }
1609
- : {}),
1677
+ // Always there, so the app theme module's import of it holds when the
1678
+ // theme's fonts change (none: a comment only).
1679
+ [`${slug}.fonts.css`]: fonts.length
1680
+ ? `${head('/*', '*/')}${fonts.map(c => `@import ${JSON.stringify(c)};`).join('\n')}\n`
1681
+ : `${head('/*', '*/')}/* No font stylesheets: no installed package loads the theme's fonts. A font the system does not have shows only once its package is installed (experimental theme editor show ${slug} names it). */\n`,
1610
1682
  };
1611
- fs.mkdirSync(dir, {recursive: true});
1683
+ return files;
1684
+ }
1685
+
1686
+ /**
1687
+ * Why a theme's app copy is behind its build, or null when it is current:
1688
+ * something in its way (appCopyStale), a copy file missing, or a file
1689
+ * whose content is not what the editor would write now.
1690
+ * @param {string} cwd
1691
+ * @param {string} slug
1692
+ * @param {string[] | null} [fontsCss] the font stylesheets the copy should
1693
+ * import now (null: the copy's own)
1694
+ * @returns {string | null}
1695
+ */
1696
+ export function appCopyBehind(cwd, slug, fontsCss = null) {
1697
+ const stale = appCopyStale(cwd, slug).appCopyStale;
1698
+ if (stale) return stale;
1699
+ const files = appCopyFiles(cwd, slug, fontsCss);
1700
+ if (!files) return null;
1701
+ const dir = path.join(cwd, 'src', 'themes', slug);
1702
+ if (!fs.existsSync(dir))
1703
+ return `the app copy in src/themes/${slug}/ is gone; the editor writes it again`;
1612
1704
  for (const [n, text] of Object.entries(files)) {
1613
- const file = path.join(dir, n);
1614
- if (fs.existsSync(file) && fs.readFileSync(file, 'utf8') === text) continue;
1615
- writeWhole(file, text);
1705
+ /** @type {string} */
1706
+ let now;
1707
+ try {
1708
+ now = fs.readFileSync(path.join(dir, n), 'utf8');
1709
+ } catch {
1710
+ return `src/themes/${slug}/${n} is missing from the app copy`;
1711
+ }
1712
+ // Line endings as a checkout writes them (CRLF on Windows) are the
1713
+ // same content, as the outputs check reads them.
1714
+ const lf = (/** @type {string} */ x) => x.replace(/\r\n/g, '\n');
1715
+ if (lf(now) !== lf(text))
1716
+ return `src/themes/${slug}/${n} is not the current build of themes/${slug}/`;
1616
1717
  }
1617
- // A file an earlier copy had (a font stylesheet no longer needed) goes;
1618
- // system files stay.
1619
- for (const n of fs.readdirSync(dir))
1620
- if (!(n in files) && !FOLDER_JUNK.has(n))
1621
- fs.rmSync(path.join(dir, n), {force: true});
1718
+ return null;
1719
+ }
1720
+
1721
+ /**
1722
+ * {@link writeAppCopy} with the font stylesheets given, or null to keep the
1723
+ * copy's own (a compile, which changes no setting).
1724
+ * @param {string} cwd
1725
+ * @param {string} slug
1726
+ * @param {string[] | null} fontsCss
1727
+ * @returns {string | null}
1728
+ */
1729
+ export function writeAppCopyAt(cwd, slug, fontsCss) {
1730
+ const f = themeFiles(cwd, slug);
1731
+ const dir = path.join(cwd, 'src', 'themes', slug);
1732
+ const name = `${camel(slug)}Theme`;
1733
+ const first = !fs.existsSync(path.join(dir, `${name}.doc.mjs`));
1734
+ if (!fs.existsSync(f.js) || !fs.existsSync(f.css)) return null;
1735
+ // Only the editor's own copy is written over.
1736
+ if (appCopyBlocker(cwd, slug) !== null) return null;
1737
+ const files = appCopyFiles(cwd, slug, fontsCss);
1738
+ if (!files) return null;
1739
+ const failKey = `${path.resolve(cwd)}\0${slug}`;
1740
+ try {
1741
+ fs.mkdirSync(dir, {recursive: true});
1742
+ for (const [n, text] of Object.entries(files)) {
1743
+ const file = path.join(dir, n);
1744
+ if (fs.existsSync(file) && fs.readFileSync(file, 'utf8') === text)
1745
+ continue;
1746
+ writeWhole(file, text);
1747
+ }
1748
+ // A copy's own file this build no longer writes goes; anything else in
1749
+ // the folder (yours, or the system's) stays as it is.
1750
+ for (const n of fs.readdirSync(dir))
1751
+ if (appCopyNames(slug).has(n) && !(n in files))
1752
+ fs.rmSync(path.join(dir, n), {force: true});
1753
+ } catch (e) {
1754
+ // A copy that cannot be written is said, with the system's reason;
1755
+ // the change itself stands.
1756
+ const code = /** @type {any} */ (e)?.code ?? 'error';
1757
+ // The folder that failed: the copy's, or a parent it could not be
1758
+ // made in.
1759
+ const failed = /** @type {any} */ (e)?.path
1760
+ ? path.resolve(String(/** @type {any} */ (e).path))
1761
+ : dir;
1762
+ const at = fs.existsSync(failed) ? failed : path.dirname(failed);
1763
+ const rel = path.relative(cwd, at).split(path.sep).join('/');
1764
+ COPY_FAILED.set(
1765
+ failKey,
1766
+ code === 'EACCES' || code === 'EPERM' || code === 'EROFS'
1767
+ ? `${rel} is not writable (${code})`
1768
+ : code === 'ENOSPC'
1769
+ ? `the disk is full (${code})`
1770
+ : `${rel} could not be written (${code})`,
1771
+ );
1772
+ return null;
1773
+ }
1774
+ COPY_FAILED.delete(failKey);
1622
1775
  // The first write is named in the command's result; later ones are not.
1623
1776
  if (first)
1624
1777
  FIRST_COPIES.set(
@@ -1633,13 +1786,48 @@ export function writeAppCopyAt(cwd, slug, fontsCss) {
1633
1786
  }
1634
1787
 
1635
1788
  /**
1636
- * Why the editor will not write a theme's app copy, or null when it will:
1637
- * the folder is not there yet, or its descriptor carries the editor's mark
1638
- * and it holds only the copy's own files (system files such as .DS_Store
1639
- * aside). Otherwise the name of what is in the way (a file of yours), or
1640
- * the folder itself when it is not the editor's copy. Built bytes are not
1641
- * compared, so a stable rebuild of the copy leaves it the editor's. The one
1642
- * test the copy's writer and `wiring` both use.
1789
+ * The note for a copy a file of yours keeps from being written, as a
1790
+ * result field: `{appCopyStale}` when one does, else nothing.
1791
+ * @param {string} cwd
1792
+ * @param {string} slug
1793
+ * @returns {{appCopyStale?: string}}
1794
+ */
1795
+ export function appCopyStale(cwd, slug) {
1796
+ const blocker =
1797
+ appCopyBlocker(cwd, slug) ??
1798
+ COPY_FAILED.get(`${path.resolve(cwd)}\0${slug}`) ??
1799
+ null;
1800
+ return blocker
1801
+ ? {
1802
+ appCopyStale: `the app copy in src/themes/${slug}/ was not updated: ${blocker}. The app keeps the theme as it was until that is out of the way; then any set or show writes it.`,
1803
+ }
1804
+ : {};
1805
+ }
1806
+
1807
+ /**
1808
+ * The names of a theme's app copy files.
1809
+ * @param {string} slug
1810
+ * @returns {Set<string>}
1811
+ */
1812
+ function appCopyNames(slug) {
1813
+ const name = `${camel(slug)}Theme`;
1814
+ return new Set([
1815
+ `${name}.doc.mjs`,
1816
+ `${name}.ts`,
1817
+ `${slug}.fonts.css`,
1818
+ ...APP_COPY_BUILT.map(ext => `${slug}${ext}`),
1819
+ ]);
1820
+ }
1821
+
1822
+ /**
1823
+ * Why the editor will not write a theme's app copy, or null when it will.
1824
+ * Only a file of yours AT one of the copy's names stops it: a descriptor,
1825
+ * source or font stylesheet without the editor's mark, or any copy file
1826
+ * while the descriptor is not the editor's. Other files there (a note, a
1827
+ * swap file, desktop.ini) are left as they are and the copy is written
1828
+ * around them. Built bytes are not compared, so a stable rebuild of the
1829
+ * copy leaves it the editor's. The one test the copy's writer, the change
1830
+ * results and `wiring` use. Returns the file in the way.
1643
1831
  * @param {string} cwd
1644
1832
  * @param {string} slug
1645
1833
  * @returns {string | null}
@@ -1648,37 +1836,89 @@ export function appCopyBlocker(cwd, slug) {
1648
1836
  const dir = path.join(cwd, 'src', 'themes', slug);
1649
1837
  const name = `${camel(slug)}Theme`;
1650
1838
  const rel = path.relative(cwd, dir).split(path.sep).join('/');
1839
+ // Nothing is written through a link on the way from the app to the copy
1840
+ // (src/, src/themes/, the copy's folder), as for themes/.
1841
+ for (const part of ['src', 'src/themes', rel]) {
1842
+ try {
1843
+ const st = fs.lstatSync(path.join(cwd, part));
1844
+ if (st.isSymbolicLink())
1845
+ return `${part} is a link (to ${fs.readlinkSync(path.join(cwd, part))}), and the editor writes nothing through a link`;
1846
+ // A file where a folder on the way goes: nothing is half-written.
1847
+ if (!st.isDirectory())
1848
+ return part === rel
1849
+ ? `${rel} is a file, where the copy's folder goes`
1850
+ : `${part} is a file, where a folder on the way to the copy goes`;
1851
+ } catch {
1852
+ break;
1853
+ }
1854
+ }
1855
+ try {
1856
+ if (!fs.lstatSync(dir).isDirectory())
1857
+ return `${rel} is a file, where the copy's folder goes`;
1858
+ } catch {
1859
+ // Not there yet: the copy makes it.
1860
+ }
1651
1861
  if (folderIsEmpty(dir)) return null;
1652
1862
  /** @type {string[]} */
1653
1863
  let names;
1654
1864
  try {
1655
1865
  names = fs.readdirSync(dir);
1656
- } catch {
1657
- return rel;
1866
+ } catch (e) {
1867
+ return `${rel} cannot be read (${/** @type {any} */ (e)?.code ?? 'error'})`;
1658
1868
  }
1659
- /** @type {boolean} */
1660
- let marked;
1661
- try {
1662
- marked = fs
1663
- .readFileSync(path.join(dir, `${name}.doc.mjs`), 'utf8')
1664
- .includes(APP_COPY_MARK);
1665
- } catch {
1666
- marked = false;
1667
- }
1668
- if (!marked) return rel;
1669
- const own = new Set([
1670
- `${name}.doc.mjs`,
1671
- `${name}.ts`,
1672
- `${slug}.fonts.css`,
1673
- ...APP_COPY_BUILT.map(ext => `${slug}${ext}`),
1674
- ]);
1675
- const other = names.find(n => !own.has(n) && !FOLDER_JUNK.has(n));
1676
- return other ? `${rel}/${other}` : null;
1869
+ /** @param {string} n */
1870
+ const marked = n => {
1871
+ try {
1872
+ return fs.readFileSync(path.join(dir, n), 'utf8').includes(APP_COPY_MARK);
1873
+ } catch {
1874
+ return false;
1875
+ }
1876
+ };
1877
+ const own = appCopyNames(slug);
1878
+ const present = names.filter(n => own.has(n));
1879
+ // A link at a copy name is never written through or replaced.
1880
+ for (const n of present)
1881
+ try {
1882
+ const st = fs.lstatSync(path.join(dir, n));
1883
+ if (st.isSymbolicLink())
1884
+ return `${rel}/${n} is a link (to ${fs.readlinkSync(path.join(dir, n))}), at a name the copy uses, and the editor writes nothing through a link`;
1885
+ if (st.isDirectory())
1886
+ return `${rel}/${n} is a folder, at a name the copy uses for a file`;
1887
+ } catch {
1888
+ // Gone since it was listed.
1889
+ }
1890
+ // The copy is the editor's when any of its marked files carries the
1891
+ // mark (one of them deleted is written back); then only a marked name
1892
+ // without the mark is yours.
1893
+ const markedNames = [`${name}.doc.mjs`, `${name}.ts`, `${slug}.fonts.css`];
1894
+ // A build output of the copy's source carries the build's own header.
1895
+ const generated = (/** @type {string} */ n) => {
1896
+ try {
1897
+ return /@generated by `astryx theme build`/.test(
1898
+ fs.readFileSync(path.join(dir, n), 'utf8').slice(0, 600),
1899
+ );
1900
+ } catch {
1901
+ return false;
1902
+ }
1903
+ };
1904
+ const ours =
1905
+ markedNames.some(n => present.includes(n) && marked(n)) ||
1906
+ (present.length > 0 &&
1907
+ present.every(n => !markedNames.includes(n) && generated(n)));
1908
+ const foreign = ours
1909
+ ? present.find(n => markedNames.includes(n) && !marked(n))
1910
+ : present[0];
1911
+ return foreign
1912
+ ? `${rel}/${foreign} is yours, at a name the copy uses, and the editor never writes over your files`
1913
+ : null;
1677
1914
  }
1678
1915
 
1679
1916
  /** The build outputs of a theme, by their ending after `<theme>`. */
1680
1917
  const APP_COPY_BUILT = ['.css', '.css.d.ts', '.js', '.d.ts', '.variants.d.ts'];
1681
1918
 
1919
+ /** Why the last write of a theme's app copy failed, by app and theme. @type {Map<string, string>} */
1920
+ const COPY_FAILED = new Map();
1921
+
1682
1922
  /** App copies written for the first time in this process, by app and theme. @type {Map<string, string[]>} */
1683
1923
  const FIRST_COPIES = new Map();
1684
1924
 
@@ -1695,3 +1935,121 @@ export function takeFirstAppCopy(cwd, slug) {
1695
1935
  FIRST_COPIES.delete(key);
1696
1936
  return wrote;
1697
1937
  }
1938
+
1939
+ /**
1940
+ * Run a browser for a picture without blocking this process: a stop that
1941
+ * reaches it (SIGINT, SIGTERM) stops the browser too, and is reported.
1942
+ * Bounded to 60 seconds, as a picture run always was.
1943
+ * @param {string} bin
1944
+ * @param {string[]} args
1945
+ * @param {number} [bound] milliseconds before the browser is stopped
1946
+ * @returns {Promise<{status: number | null, signal: string | null, stderr: string, error?: Error, stoppedBy?: string, timedOut?: boolean}>}
1947
+ */
1948
+ export function runBrowser(bin, args, bound = 60_000) {
1949
+ return new Promise(resolve => {
1950
+ /** @type {string | undefined} */
1951
+ let stoppedBy;
1952
+ let stderr = '';
1953
+ // A profile folder of its own, removed on every way out (done, failed,
1954
+ // timed out, stopped): Chrome leaves its org.chromium.* folders in the
1955
+ // system temp folder otherwise.
1956
+ /** @type {string | null} */
1957
+ let profile = null;
1958
+ try {
1959
+ profile = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-chrome-'));
1960
+ } catch {
1961
+ // No temp folder: Chrome's own default.
1962
+ }
1963
+ const dropProfile = () => {
1964
+ if (profile)
1965
+ try {
1966
+ fs.rmSync(profile, {recursive: true, force: true});
1967
+ } catch {
1968
+ // Gone already.
1969
+ }
1970
+ };
1971
+ process.once('exit', dropProfile);
1972
+ const child = spawn(
1973
+ bin,
1974
+ [...(profile ? [`--user-data-dir=${profile}`] : []), ...args],
1975
+ {
1976
+ stdio: ['ignore', 'ignore', 'pipe'],
1977
+ env: profile ? {...process.env, TMPDIR: profile} : process.env,
1978
+ // A group of its own, so a stop takes Chrome's helper processes
1979
+ // with it, before its profile folder is removed.
1980
+ detached: process.platform !== 'win32',
1981
+ },
1982
+ );
1983
+ const killAll = () => {
1984
+ try {
1985
+ if (process.platform !== 'win32' && child.pid)
1986
+ process.kill(-child.pid, 'SIGKILL');
1987
+ else child.kill('SIGKILL');
1988
+ } catch {
1989
+ child.kill('SIGKILL');
1990
+ }
1991
+ };
1992
+ child.stderr?.setEncoding('utf8');
1993
+ child.stderr?.on('data', d => {
1994
+ if (stderr.length < 8000) stderr += d;
1995
+ });
1996
+ let timedOut = false;
1997
+ const timer = setTimeout(() => {
1998
+ timedOut = true;
1999
+ killAll();
2000
+ }, bound);
2001
+ /** @param {NodeJS.Signals} sig */
2002
+ const onStop = sig => {
2003
+ stoppedBy = sig;
2004
+ killAll();
2005
+ dropProfile();
2006
+ // Nothing else listening: the stop ends this process, as it would
2007
+ // have without this listener.
2008
+ if (process.listenerCount(sig) === 0) {
2009
+ process.removeListener('SIGINT', onStop);
2010
+ process.removeListener('SIGTERM', onStop);
2011
+ process.kill(process.pid, sig);
2012
+ }
2013
+ };
2014
+ process.once('SIGINT', onStop);
2015
+ process.once('SIGTERM', onStop);
2016
+ const done = (/** @type {any} */ out) => {
2017
+ clearTimeout(timer);
2018
+ dropProfile();
2019
+ process.removeListener('exit', dropProfile);
2020
+ process.removeListener('SIGINT', onStop);
2021
+ process.removeListener('SIGTERM', onStop);
2022
+ resolve({
2023
+ ...out,
2024
+ stderr,
2025
+ ...(stoppedBy ? {stoppedBy} : {}),
2026
+ ...(timedOut ? {timedOut} : {}),
2027
+ });
2028
+ };
2029
+ child.on('error', error => done({status: null, signal: null, error}));
2030
+ child.on('close', (status, signal) => done({status, signal}));
2031
+ });
2032
+ }
2033
+
2034
+ /**
2035
+ * The first stderr line that says something about the picture: Chrome's
2036
+ * startup warnings (dbus, GPU, sandbox notices) come first on Linux and
2037
+ * say nothing about why no picture was written.
2038
+ * @param {string} text
2039
+ */
2040
+ export function meaningfulLine(text) {
2041
+ const lines = String(text ?? '')
2042
+ .split(/\r?\n/)
2043
+ .map(l => l.trim())
2044
+ .filter(Boolean);
2045
+ return (
2046
+ lines.find(
2047
+ l =>
2048
+ !/dbus|bus\.cc|gpu_|gl_|sandbox|fontconfig|crashpad|DevTools listening|WARNING:/i.test(
2049
+ l,
2050
+ ),
2051
+ ) ??
2052
+ lines[0] ??
2053
+ ''
2054
+ );
2055
+ }