@astryxdesign/cli 0.7.16 → 0.7.17-canary.g49a475f

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 (354) hide show
  1. package/README.md +76 -86
  2. package/api/build/_adapter.d.mts +12 -0
  3. package/api/build/_adapter.mjs +51 -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 +4 -3
  7. package/api/build/build.type.d.mts +2 -2
  8. package/api/build/build.type.mjs +3 -3
  9. package/api/build/kit/kind.d.mts +2 -1
  10. package/api/build/kit/kind.mjs +199 -10
  11. package/api/build/kit/kit.mjs +6 -4
  12. package/api/build/kit/rank.d.mts +4 -2
  13. package/api/build/kit/rank.mjs +125 -24
  14. package/api/build/kit/start.d.mts +5 -4
  15. package/api/build/kit/start.mjs +12 -8
  16. package/api/build/kit/weights.d.mts +39 -3
  17. package/api/build/kit/weights.json +1 -1
  18. package/api/build/kit/weights.mjs +340 -43
  19. package/api/build/kit/word-model.d.mts +23 -0
  20. package/api/build/kit/word-model.mjs +46 -0
  21. package/api/build/kit/words.d.mts +48 -0
  22. package/api/build/kit/words.mjs +90 -1
  23. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  24. package/api/component/list/list.d.mts +1 -1
  25. package/api/component/list/list.mjs +48 -6
  26. package/api/discover/_adapter.d.mts +1 -1
  27. package/api/discover/search/search.mjs +3 -2
  28. package/api/docs/_adapter.d.mts +26 -2
  29. package/api/docs/_adapter.mjs +219 -6
  30. package/api/docs/docs.d.mts +3 -0
  31. package/api/docs/docs.doc.mjs +7 -1
  32. package/api/docs/docs.mjs +12 -0
  33. package/api/docs/docs.type.d.mts +5 -0
  34. package/api/docs/docs.type.mjs +2 -0
  35. package/api/docs/node/node.mjs +1 -1
  36. package/api/doctor/_adapter.d.mts +27 -5
  37. package/api/doctor/_adapter.mjs +83 -10
  38. package/api/doctor/built-checks.mjs +40 -14
  39. package/api/doctor/doctor.d.mts +4 -3
  40. package/api/doctor/doctor.mjs +14 -7
  41. package/api/doctor/theme-checks.mjs +121 -17
  42. package/api/icon/_records.mjs +2 -1
  43. package/api/index.d.mts +2 -0
  44. package/api/index.mjs +2 -0
  45. package/api/integration/_adapter.d.mts +44 -0
  46. package/api/integration/_adapter.mjs +77 -1
  47. package/api/integration/authoring-checks.mjs +6 -6
  48. package/api/integration/example-scope.d.mts +14 -0
  49. package/api/integration/example-scope.mjs +44 -0
  50. package/api/integration/example-scope.type.d.mts +29 -0
  51. package/api/integration/example-scope.type.mjs +25 -0
  52. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  53. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  54. package/api/integration/validate-integration.mjs +19 -1
  55. package/api/integration/validate-integration.type.d.mts +9 -0
  56. package/api/integration/validate-integration.type.mjs +1 -1
  57. package/api/integration/validateIntegration.doc.mjs +1 -1
  58. package/api/render/_adapter.mjs +591 -195
  59. package/api/render/render.doc.mjs +11 -3
  60. package/api/render/render.type.d.mts +52 -0
  61. package/api/render/render.type.mjs +31 -1
  62. package/api/search/ORDERING.md +1 -1
  63. package/api/search/_adapter.d.mts +9 -0
  64. package/api/search/_adapter.mjs +85 -0
  65. package/api/search/_candidate-score.mjs +51 -32
  66. package/api/search/_fit-order.mjs +3 -3
  67. package/api/search/_gather-components.d.mts +3 -2
  68. package/api/search/_gather-components.mjs +12 -3
  69. package/api/search/_lexical.d.mts +5 -0
  70. package/api/search/_lexical.mjs +8 -2
  71. package/api/search/_result.d.mts +11 -9
  72. package/api/search/_result.mjs +4 -4
  73. package/api/search/_score.d.mts +6 -1
  74. package/api/search/_score.mjs +15 -3
  75. package/api/search/search-index.mjs +7 -1
  76. package/api/search/search.d.mts +1 -1
  77. package/api/theme/_adapter.mjs +12 -1
  78. package/api/theme/build/build.d.mts +75 -0
  79. package/api/theme/build/build.mjs +243 -58
  80. package/api/theme/build/font-warning.d.mts +7 -0
  81. package/api/theme/build/font-warning.mjs +17 -0
  82. package/api/theme/theme.type.d.mts +10 -0
  83. package/api/theme/theme.type.mjs +7 -1
  84. package/api/theme-edit/_adapter.d.mts +63 -2
  85. package/api/theme-edit/_adapter.mjs +771 -57
  86. package/api/theme-edit/_check.d.mts +40 -22
  87. package/api/theme-edit/_check.mjs +2029 -336
  88. package/api/theme-edit/_color.d.mts +10 -0
  89. package/api/theme-edit/_color.mjs +49 -1
  90. package/api/theme-edit/_compiler.mjs +9 -0
  91. package/api/theme-edit/_context.d.mts +3 -3
  92. package/api/theme-edit/_context.mjs +111 -48
  93. package/api/theme-edit/_css.d.mts +14 -0
  94. package/api/theme-edit/_css.mjs +46 -1
  95. package/api/theme-edit/_edit.d.mts +18 -4
  96. package/api/theme-edit/_edit.mjs +1685 -155
  97. package/api/theme-edit/_how-commands.d.mts +65 -0
  98. package/api/theme-edit/_how-commands.mjs +633 -1
  99. package/api/theme-edit/_how-question.d.mts +84 -0
  100. package/api/theme-edit/_how-question.mjs +5124 -281
  101. package/api/theme-edit/_how.mjs +140 -29
  102. package/api/theme-edit/_marks.d.mts +31 -5
  103. package/api/theme-edit/_marks.mjs +57 -5
  104. package/api/theme-edit/_name-rule.d.mts +11 -0
  105. package/api/theme-edit/_name-rule.mjs +12 -0
  106. package/api/theme-edit/_normal.d.mts +257 -0
  107. package/api/theme-edit/_normal.mjs +1252 -0
  108. package/api/theme-edit/_palette.mjs +10 -4
  109. package/api/theme-edit/_parts.d.mts +10 -1
  110. package/api/theme-edit/_parts.mjs +179 -3
  111. package/api/theme-edit/_preview-app.d.mts +7 -1
  112. package/api/theme-edit/_preview-app.mjs +515 -148
  113. package/api/theme-edit/_preview.d.mts +100 -14
  114. package/api/theme-edit/_preview.mjs +549 -137
  115. package/api/theme-edit/_settings.d.mts +347 -30
  116. package/api/theme-edit/_settings.mjs +2971 -327
  117. package/api/theme-edit/_tables.d.mts +6 -0
  118. package/api/theme-edit/_tables.mjs +44 -1
  119. package/api/theme-edit/_vet.d.mts +18 -0
  120. package/api/theme-edit/_vet.mjs +32 -0
  121. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  122. package/api/theme-edit/theme-edit.type.mjs +4 -1
  123. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  124. package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
  125. package/api/theme-edit/themeEditNew.doc.mjs +7 -4
  126. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  128. package/api/upgrade/run/run.mjs +4 -3
  129. package/assets/codemods/integration-discovery.mjs +2 -1
  130. package/assets/codemods/run-codemod.mjs +87 -7
  131. package/assets/codemods/transforms/next/index.mjs +11 -1
  132. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  133. package/assets/component-list.generated.json +1 -0
  134. package/assets/docs/author-a-theme.doc.mjs +1 -0
  135. package/assets/docs/theme.doc.dense.mjs +2 -2
  136. package/assets/docs/theme.doc.mjs +1 -1
  137. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  138. package/assets/docs/tree/checks.doc.mjs +1 -1
  139. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  140. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  141. package/assets/docs/tree/single-component.doc.mjs +4 -0
  142. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  143. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  144. package/assets/docs/use-a-theme.doc.mjs +1 -1
  145. package/assets/docs.generated.json +2 -2
  146. package/assets/search-catalog.generated.json +2 -0
  147. package/assets/self-audit.generated.json +1 -1
  148. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  149. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  150. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  151. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  152. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  153. package/assets/templates/components.generated.json +1 -1
  154. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  155. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  156. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  157. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  158. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  159. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  160. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  161. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  162. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  163. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  164. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  165. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  166. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  167. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  168. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  169. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  170. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  171. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  172. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  173. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  174. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  175. package/assets/templates/pages/ide/page.tsx +24 -2
  176. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  177. package/assets/templates/pages/library/template.doc.mjs +4 -1
  178. package/assets/templates/pages/login/template.doc.mjs +2 -1
  179. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  180. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  181. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  182. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  183. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  184. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  185. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  186. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  187. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  188. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  189. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  190. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  191. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  192. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  193. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  194. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  195. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  196. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  197. package/assets/theme.template.ts +6 -0
  198. package/authoring/debug/parse.d.mts +3 -3
  199. package/authoring/doctypes/_schema.d.mts +3 -3
  200. package/authoring/doctypes/command/command.doc.mjs +1 -1
  201. package/authoring/doctypes/component/categories.d.mts +37 -0
  202. package/authoring/doctypes/component/categories.mjs +54 -0
  203. package/authoring/doctypes/template/template.doc.mjs +1 -1
  204. package/authoring/doctypes/template/type.ts +9 -0
  205. package/authoring/example/example.doc.d.mts +12 -0
  206. package/authoring/example/example.doc.mjs +69 -0
  207. package/authoring/example/preview.d.mts +92 -0
  208. package/authoring/example/preview.mjs +994 -0
  209. package/authoring/example/type.ts +102 -0
  210. package/authoring/index.d.mts +1 -0
  211. package/authoring/index.d.ts +12 -0
  212. package/authoring/index.mjs +3 -1
  213. package/clients/cli/bin/astryx.mjs +6 -9
  214. package/clients/cli/build-id.generated.json +1 -1
  215. package/clients/cli/commands/component.doc.mjs +1 -1
  216. package/clients/cli/commands/component.mjs +22 -3
  217. package/clients/cli/commands/docs.doc.mjs +7 -1
  218. package/clients/cli/commands/docs.mjs +3 -1
  219. package/clients/cli/commands/doctor.mjs +32 -14
  220. package/clients/cli/commands/experimental/render.mjs +42 -1
  221. package/clients/cli/commands/experimental/theme.mjs +163 -28
  222. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  223. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  224. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  225. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
  226. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  227. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  228. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  229. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  230. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  231. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  232. package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
  233. package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
  234. package/clients/cli/commands/search.doc.mjs +2 -1
  235. package/clients/cli/commands/search.mjs +6 -1
  236. package/clients/cli/commands/template.mjs +4 -2
  237. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  238. package/clients/cli/commands/theme.doc.mjs +1 -1
  239. package/clients/cli/commands/theme.mjs +209 -8
  240. package/clients/cli/commands/upgrade.mjs +42 -7
  241. package/clients/cli/index.mjs +1 -1
  242. package/clients/cli/lib/cli-error.mjs +2 -1
  243. package/clients/cli/lib/component-format.mjs +205 -98
  244. package/clients/cli/lib/hook-format.mjs +9 -19
  245. package/clients/cli/lib/json-shim.mjs +77 -21
  246. package/clients/cli/lib/manifest.mjs +3 -2
  247. package/clients/cli/manifest.generated.json +1 -1
  248. package/foundation/agent-docs/agent-docs.mjs +1 -1
  249. package/foundation/config/theme-state.d.mts +13 -1
  250. package/foundation/config/theme-state.mjs +47 -7
  251. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  252. package/foundation/discovery/component-discovery.d.mts +11 -0
  253. package/foundation/discovery/component-discovery.mjs +56 -8
  254. package/foundation/discovery/component-replacement.mjs +130 -1
  255. package/foundation/discovery/copied-passages.mjs +2 -1
  256. package/foundation/discovery/doc-types.mjs +4 -3
  257. package/foundation/discovery/entry-name-files.d.mts +43 -0
  258. package/foundation/discovery/entry-name-files.mjs +264 -0
  259. package/foundation/discovery/hook-discovery.d.mts +8 -2
  260. package/foundation/discovery/hook-discovery.mjs +22 -8
  261. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  262. package/foundation/discovery/icon-set-checks.mjs +2 -1
  263. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  264. package/foundation/discovery/integration-doc-files.mjs +2 -1
  265. package/foundation/discovery/package-exports.d.mts +10 -0
  266. package/foundation/discovery/package-exports.mjs +56 -3
  267. package/foundation/discovery/prop-drift.mjs +9 -9
  268. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  269. package/foundation/discovery/runner-allowlist.mjs +2 -0
  270. package/foundation/discovery/stored-component-list.d.mts +43 -0
  271. package/foundation/discovery/stored-component-list.mjs +90 -0
  272. package/foundation/discovery/stored-search-catalog.d.mts +115 -0
  273. package/foundation/discovery/stored-search-catalog.mjs +297 -0
  274. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  275. package/foundation/discovery/stored-self-audit.mjs +38 -18
  276. package/foundation/discovery/template-adapter.d.mts +52 -0
  277. package/foundation/discovery/template-adapter.mjs +176 -12
  278. package/foundation/discovery/template-icons.mjs +2 -1
  279. package/foundation/discovery/theme-discovery.mjs +3 -2
  280. package/foundation/discovery/theme-imports.d.mts +14 -0
  281. package/foundation/discovery/theme-imports.mjs +43 -1
  282. package/foundation/discovery/theming-targets.mjs +3 -2
  283. package/foundation/doc-compiler/import.mjs +7 -1
  284. package/foundation/doc-compiler/inputs.mjs +3 -2
  285. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  286. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  287. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  288. package/foundation/env/semver.mjs +3 -1
  289. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  290. package/foundation/fonts/font-stylesheet.mjs +115 -0
  291. package/foundation/fs/cache-eviction.d.mts +21 -0
  292. package/foundation/fs/cache-eviction.mjs +73 -0
  293. package/foundation/fs/file-protection.mjs +4 -3
  294. package/foundation/fs/gather-cache.d.mts +25 -4
  295. package/foundation/fs/gather-cache.mjs +164 -55
  296. package/foundation/fs/jiti-cache.d.mts +19 -1
  297. package/foundation/fs/jiti-cache.mjs +130 -6
  298. package/foundation/fs/kept-tree.d.mts +60 -0
  299. package/foundation/fs/kept-tree.mjs +154 -0
  300. package/foundation/fs/listing-cache.d.mts +7 -0
  301. package/foundation/fs/listing-cache.mjs +10 -0
  302. package/foundation/fs/module-loader.d.mts +24 -2
  303. package/foundation/fs/module-loader.mjs +94 -21
  304. package/foundation/fs/paths.d.mts +18 -0
  305. package/foundation/fs/paths.mjs +15 -2
  306. package/foundation/identity/provider-identity.d.mts +6 -0
  307. package/foundation/identity/provider-identity.mjs +10 -1
  308. package/foundation/integrations/contribution-inventory.mjs +4 -3
  309. package/foundation/integrations/example-code.d.mts +63 -0
  310. package/foundation/integrations/example-code.mjs +416 -0
  311. package/foundation/integrations/public-imports.d.mts +9 -0
  312. package/foundation/integrations/public-imports.mjs +3 -2
  313. package/foundation/integrations/validate-contributions.mjs +17 -45
  314. package/foundation/render/embedded-files.d.mts +6 -0
  315. package/foundation/render/embedded-files.mjs +25 -5
  316. package/foundation/render/embedded-imports.d.mts +39 -7
  317. package/foundation/render/embedded-imports.mjs +66 -27
  318. package/foundation/render/file-header.d.mts +66 -0
  319. package/foundation/render/file-header.mjs +118 -0
  320. package/foundation/render/host-answer.d.mts +18 -0
  321. package/foundation/render/host-answer.mjs +46 -0
  322. package/foundation/render/host-exit.d.mts +1 -0
  323. package/foundation/render/host-exit.mjs +6 -1
  324. package/foundation/render/html-reader.d.mts +55 -2
  325. package/foundation/render/html-reader.mjs +145 -26
  326. package/foundation/render/markup-edits.d.mts +57 -0
  327. package/foundation/render/markup-edits.mjs +182 -0
  328. package/foundation/render/page-host.mjs +29 -12
  329. package/foundation/render/page-worker.mjs +121 -13
  330. package/foundation/render/picture-chrome.d.mts +4 -0
  331. package/foundation/render/picture-chrome.mjs +185 -0
  332. package/foundation/render/picture-playwright.d.mts +4 -0
  333. package/foundation/render/picture-playwright.mjs +34 -0
  334. package/foundation/render/rebuild.mjs +2 -1
  335. package/foundation/render/render-page.d.mts +35 -3
  336. package/foundation/render/render-page.mjs +316 -42
  337. package/foundation/render/source-block.d.mts +85 -6
  338. package/foundation/render/source-block.mjs +211 -20
  339. package/foundation/render/ts-paths.d.mts +69 -6
  340. package/foundation/render/ts-paths.mjs +326 -40
  341. package/foundation/response/error-codes.d.mts +3 -1
  342. package/foundation/response/error-codes.d.ts +1 -0
  343. package/foundation/response/error-codes.doc.mjs +12 -1
  344. package/foundation/response/error-codes.mjs +11 -1
  345. package/foundation/response/response-types.doc.mjs +2 -2
  346. package/foundation/text/compare-text.d.mts +14 -0
  347. package/foundation/text/compare-text.mjs +68 -0
  348. package/foundation/text/string-utils.d.mts +3 -2
  349. package/foundation/text/string-utils.mjs +18 -4
  350. package/foundation/text/suggest-order.d.mts +9 -0
  351. package/foundation/text/suggest-order.mjs +15 -1
  352. package/foundation/xle/expand.mjs +2 -1
  353. package/host/index.mjs +8 -6
  354. package/package.json +7 -6
@@ -18,7 +18,7 @@
18
18
  * so the server render sets them aside and draws them after it with React
19
19
  * DOM in a small document (charts.mjs).
20
20
  *
21
- * @input workerData {entry, root, served, withoutSegmenter}
21
+ * @input workerData {entry, root, scope, served, withoutSegmenter}
22
22
  * @output one message: {ok: true, markup, css, files, texts, logs} or
23
23
  * {ok: false, error: {code, message, detail?}}
24
24
  * @position foundation/render — started by page-host.mjs
@@ -31,17 +31,18 @@ import {pathToFileURL} from 'node:url';
31
31
  import {format} from 'node:util';
32
32
  import {parentPort, workerData} from 'node:worker_threads';
33
33
  import {transformSync} from '@babel/core';
34
- import {matchPath, readPathsIn, resolvePath} from './ts-paths.mjs';
34
+ import {LOAD_EXTENSIONS, existingFile, matchPath, pathsFor, resolvePath} from './ts-paths.mjs';
35
35
  import {createJiti} from 'jiti';
36
36
  import {assetDataUri, isAssetPath} from './assets.mjs';
37
- import {SINGLE_COPY, isServedPackage, packageOf} from './served-packages.mjs';
37
+ import {SINGLE_COPY, isServedPackage, packageOf, resolveServed} from './served-packages.mjs';
38
38
  import {findNodeModulesPackage} from '../fs/paths.mjs';
39
+ import {importSpecifiers} from './embedded-imports.mjs';
39
40
  import {CHART_GLOBAL, CHART_ROOTS, chartDocument, chartSize, markLegends} from './charts.mjs';
40
41
 
41
42
  /** @typedef {{level: string, text: string}} PageLog */
42
43
 
43
- /** @type {{entry: string, root: string, served: {dir: string, integrations: string[]} | null, withoutSegmenter?: boolean}} */
44
- const {entry, root} = workerData;
44
+ /** @type {{entry: string, root: string, scope: string, served: {dir: string, integrations: string[]} | null, withoutSegmenter?: boolean}} */
45
+ const {entry, root, scope} = workerData;
45
46
 
46
47
  // Some Node builds crash in Intl.Segmenter. Without it, Core splits text by
47
48
  // code points, so a joined emoji can count as several characters.
@@ -49,7 +50,8 @@ if (workerData.withoutSegmenter) delete (/** @type {any} */ (Intl)).Segmenter;
49
50
 
50
51
  /** The package set, for a page outside a project whose folder has no Core of its own. */
51
52
  const served = workerData.served && findNodeModulesPackage(path.dirname(entry), '@astryxdesign/core') === null ? workerData.served : null;
52
- const ROOT_PREFIX = root.endsWith(path.sep) ? root : root + path.sep;
53
+ /** The folder whose modules the page carries (see render-page.mjs `carryScopeOf`). */
54
+ const SCOPE_PREFIX = scope.endsWith(path.sep) ? scope : scope + path.sep;
53
55
 
54
56
  /** @type {PageLog[]} */
55
57
  const logs = [];
@@ -143,10 +145,10 @@ const fnKey = p => {
143
145
 
144
146
  const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
145
147
 
146
- /** A module of the project itself: inside its folder, not a package.
148
+ /** A module of the page's own: inside the folder whose modules it carries, not a package.
147
149
  * @param {string} file */
148
150
  const isLocal = file =>
149
- !file.includes(NODE_MODULES) && (file === entry || file.startsWith(ROOT_PREFIX));
151
+ !file.includes(NODE_MODULES) && (file === entry || file.startsWith(SCOPE_PREFIX));
150
152
 
151
153
  /** Charts the server render set aside, drawn after it. @type {any[]} */
152
154
  const charts = [];
@@ -412,6 +414,39 @@ function pagePlugin(filename) {
412
414
  // (`@/styles/site.css`) resolves the way modules do.
413
415
  const bare =
414
416
  isAliased(raw) && (/\.(css|scss|sass|less|json)$/i.test(raw) || isAssetPath(raw)) ? resolveAlias(raw) : raw;
417
+ const query = spec.includes('?') ? spec.slice(spec.indexOf('?') + 1) : '';
418
+ const target = isAliased(raw) ? resolveAlias(raw) : raw;
419
+ if (query && (target.startsWith('.') || path.isAbsolute(target))) {
420
+ // `?raw` gives the file's text and `?inline` a stylesheet's text (not
421
+ // added to the page), as Vite does by itself. Any other query loads
422
+ // the file as it loads without one: an image, font or media file as
423
+ // its address (`?url`, `?inline`, `?w=400`), a module as itself.
424
+ const file = path.resolve(dir, target);
425
+ if (query === 'raw' || (query === 'inline' && /\.css$/i.test(target))) {
426
+ if (!fs.existsSync(file)) {
427
+ const err = new Error(`${path.basename(filename)} imports ${spec}, which does not exist.`);
428
+ /** @type {any} */ (err).renderCode = 'ERR_FILE_NOT_FOUND';
429
+ throw err;
430
+ }
431
+ if (!localFiles.includes(file)) localFiles.push(file);
432
+ // The text is the module's default export, as Vite gives it, to
433
+ // every way of importing it.
434
+ const text = t.stringLiteral(fs.readFileSync(file, 'utf8'));
435
+ const declarators = p.node.specifiers.map((/** @type {any} */ s) =>
436
+ t.variableDeclarator(
437
+ t.identifier(s.local.name),
438
+ s.type === 'ImportNamespaceSpecifier'
439
+ ? t.objectExpression([t.objectProperty(t.identifier('default'), text)])
440
+ : s.type === 'ImportDefaultSpecifier' || (s.imported.name ?? s.imported.value) === 'default'
441
+ ? text
442
+ : t.identifier('undefined'),
443
+ ),
444
+ );
445
+ if (declarators.length > 0) p.replaceWith(t.variableDeclaration('const', declarators));
446
+ else p.remove();
447
+ return;
448
+ }
449
+ }
415
450
  if (!bare.startsWith('.') && !path.isAbsolute(bare) && !isAliased(bare)) {
416
451
  packages.add(
417
452
  bare.startsWith('@')
@@ -579,10 +614,11 @@ function pagePlugin(filename) {
579
614
  }
580
615
 
581
616
  /**
582
- * The project's path aliases (`compilerOptions.paths` in tsconfig.json or
583
- * jsconfig.json), matched by TypeScript's rules (see ts-paths.mjs).
617
+ * The page's path aliases (`compilerOptions.paths` in the tsconfig.json or
618
+ * jsconfig.json that TypeScript reads for the page), matched by TypeScript's
619
+ * rules (see ts-paths.mjs).
584
620
  */
585
- const PATHS = readPathsIn(root) ?? [];
621
+ const PATHS = pathsFor(path.resolve(entry));
586
622
 
587
623
  /** @param {string} spec whether a specifier goes through a project alias */
588
624
  const isAliased = spec => resolvePath(PATHS, spec) !== null;
@@ -607,6 +643,20 @@ const namesAlias = spec => {
607
643
  */
608
644
  const resolveAlias = spec => resolvePath(PATHS, spec) ?? spec;
609
645
 
646
+ /**
647
+ * The file a relative or aliased import names, found the way the render
648
+ * loads it, or null for a package import or a file that does not exist.
649
+ * @param {string} spec
650
+ * @param {string} from the importing file
651
+ * @returns {string | null}
652
+ */
653
+ function importedFile(spec, from) {
654
+ const raw = spec.split('?')[0];
655
+ if (raw.startsWith('.')) return existingFile(path.resolve(path.dirname(from), raw), LOAD_EXTENSIONS);
656
+ // An alias resolves by TypeScript's rules, as the import rewrite loads it.
657
+ return isAliased(raw) ? resolveAlias(raw) : null;
658
+ }
659
+
610
660
  /** Packages the page took from the package set, by name: their folders. */
611
661
  /** @type {Map<string, string>} */
612
662
  const fromSet = new Map();
@@ -698,18 +748,47 @@ if (servedParent && Object.keys(SINGLE_COPY_ALIASES).length > 0) {
698
748
  });
699
749
  }
700
750
 
751
+ /** What the StyleX compiler reads as a theme or constants file, by name. */
752
+ const STYLEX_THEME_FILE = /\.(?:stylex(?:\.const)?|transformed)(?:\.(?:js|ts|tsx|jsx|mjs|cjs))?$/;
753
+
754
+ /**
755
+ * Outside a project, the file the page loads for each StyleX theme file a
756
+ * module imports from a package, for the StyleX compiler. The compiler finds
757
+ * a theme import from the folder of the file that imports it, which outside
758
+ * a project holds no copy of the packages the set serves, so it is given the
759
+ * file the page loads. Its own rules still name that file for the variables'
760
+ * names, so they match the package's stylesheet.
761
+ * @param {string} source
762
+ * @param {string} filename
763
+ * @returns {Record<string, string[]> | null}
764
+ */
765
+ function servedThemeFiles(source, filename) {
766
+ if (!served) return null;
767
+ /** @type {Record<string, string[]>} */
768
+ const files = {};
769
+ for (const spec of importSpecifiers(source, filename)) {
770
+ if (spec.startsWith('.') || path.isAbsolute(spec) || !STYLEX_THEME_FILE.test(spec)) continue;
771
+ const file = resolveServed(spec, filename, served);
772
+ if (file) files[spec] = [file];
773
+ }
774
+ return Object.keys(files).length > 0 ? files : null;
775
+ }
776
+
701
777
  const plain = createJiti(entry, {fsCache: false, jsx: {runtime: 'automatic'}});
702
778
 
703
779
  const jiti = createJiti(entry, {
704
780
  fsCache: false,
705
781
  tryNative: false,
706
- extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.mts', '.cts', '.json'],
782
+ extensions: [...LOAD_EXTENSIONS],
707
783
  moduleCache: true,
708
784
  interopDefault: true,
709
785
  alias: SINGLE_COPY_ALIASES,
710
786
  jsx: {runtime: 'automatic'},
711
787
  transform(opts) {
712
- const filename = opts.filename ?? '';
788
+ // jiti names the file with forward slashes on Windows (`C:/...`), while
789
+ // `entry`, `root` and the node_modules test use the platform separator.
790
+ // Without this, no file reads as local there and none is transformed.
791
+ const filename = opts.filename ? path.normalize(opts.filename) : '';
713
792
  let source = opts.source;
714
793
  if (filename && isLocal(filename) && /\.json$/i.test(filename) && !localFiles.includes(filename)) {
715
794
  localFiles.push(filename);
@@ -717,6 +796,7 @@ const jiti = createJiti(entry, {
717
796
  if (filename && isLocal(filename) && /\.(tsx?|jsx?|mjs|cjs|mts|cts)$/.test(filename)) {
718
797
  if (!localFiles.includes(filename)) localFiles.push(filename);
719
798
  const ts = /\.(tsx?|mts|cts)$/.test(filename);
799
+ const themeFiles = source.includes('stylex') ? servedThemeFiles(source, filename) : null;
720
800
  const result = transformSync(source, {
721
801
  filename,
722
802
  babelrc: false,
@@ -737,6 +817,7 @@ const jiti = createJiti(entry, {
737
817
  runtimeInjection: false,
738
818
  treeshakeCompensation: true,
739
819
  unstable_moduleResolution: {type: 'commonJS', rootDir: root},
820
+ ...(themeFiles ? {aliases: themeFiles} : {}),
740
821
  },
741
822
  ],
742
823
  ]
@@ -909,6 +990,32 @@ try {
909
990
  reach('compiling styles');
910
991
  css = stylexPlugin.processStylexRules(stylexRules, {useLayers: false});
911
992
  }
993
+ // Node loads some local modules itself (jiti hands it a plain ES module,
994
+ // such as a built theme), so they never pass the transform that records
995
+ // local files. Follow the imports of every local module instead, so the
996
+ // file carries each module the page reaches, as --reverse expects.
997
+ /** Every path-alias import a local module makes, with the file it names. @type {{spec: string, file: string}[]} */
998
+ const aliasImports = [];
999
+ for (let i = 0; i < localFiles.length; i++) {
1000
+ const file = localFiles[i];
1001
+ if (!/\.[cm]?[jt]sx?$/.test(file)) continue;
1002
+ let source;
1003
+ try {
1004
+ source = fs.readFileSync(file, 'utf8');
1005
+ } catch {
1006
+ continue;
1007
+ }
1008
+ for (const spec of importSpecifiers(source, file)) {
1009
+ const target = importedFile(spec, file);
1010
+ const raw = spec.split('?')[0];
1011
+ if (target && !raw.startsWith('.')) aliasImports.push({spec: raw, file: target});
1012
+ // Modules and JSON only: the transform already carries the stylesheets
1013
+ // and images a module imports, and a Sass file is never carried.
1014
+ if (target && /\.([cm]?[jt]sx?|json)$/i.test(target) && isLocal(target) && !localFiles.includes(target)) {
1015
+ localFiles.push(target);
1016
+ }
1017
+ }
1018
+ }
912
1019
  parentPort?.postMessage({
913
1020
  ok: true,
914
1021
  markup,
@@ -922,6 +1029,7 @@ try {
922
1029
  chartsAlone,
923
1030
  assets: [...assetsInlined],
924
1031
  files: localFiles,
1032
+ aliasImports,
925
1033
  texts,
926
1034
  fnTexts,
927
1035
  logs,
@@ -0,0 +1,4 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ export {};
@@ -0,0 +1,185 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file One whole-page picture of a page through a Chrome or Chromium,
5
+ * driven over the DevTools protocol on a pipe, run as its own process by the
6
+ * editor's browser runner.
7
+ * @input argv: the browser, the page (.html), the picture (.png), the color
8
+ * mode
9
+ * @output the whole page, every pixel of its height, at the path given; on
10
+ * failure, the browser's reason on stderr and exit code 1
11
+ * @position run by `screenshot` in api/theme-edit/_preview.mjs through
12
+ * `runBrowser`, which gives it a temp folder of its own (the browser's
13
+ * profile goes there), its time bound and its stop
14
+ */
15
+
16
+ import {spawn} from 'node:child_process';
17
+ import * as fs from 'node:fs';
18
+ import * as os from 'node:os';
19
+ import * as path from 'node:path';
20
+ import {pathToFileURL} from 'node:url';
21
+
22
+ const [chrome, html, png, mode] = process.argv.slice(2);
23
+
24
+ const browser = spawn(
25
+ chrome,
26
+ [
27
+ '--headless=new',
28
+ '--disable-gpu',
29
+ '--no-sandbox',
30
+ '--hide-scrollbars',
31
+ '--remote-debugging-pipe',
32
+ `--user-data-dir=${path.join(os.tmpdir(), 'profile')}`,
33
+ 'about:blank',
34
+ ],
35
+ // The protocol runs on fds 3 (to the browser) and 4 (from it).
36
+ {stdio: ['ignore', 'ignore', 'pipe', 'pipe', 'pipe']},
37
+ );
38
+ // Stopped by the runner (its group gets the signal): the browser is closed
39
+ // and waited for before this process ends, so nothing still writes to the
40
+ // profile in the temp folder the runner then removes.
41
+ for (const sig of /** @type {const} */ (['SIGTERM', 'SIGINT', 'SIGHUP']))
42
+ process.on(sig, () => {
43
+ if (browser.exitCode != null || browser.signalCode != null) process.exit(1);
44
+ browser.once('close', () => process.exit(1));
45
+ browser.kill('SIGTERM');
46
+ });
47
+ let stderr = '';
48
+ browser.stderr?.setEncoding('utf8');
49
+ browser.stderr?.on('data', d => {
50
+ if (stderr.length < 8000) stderr += d;
51
+ });
52
+ const toBrowser = /** @type {import('node:stream').Writable} */ (
53
+ browser.stdio[3]
54
+ );
55
+ const fromBrowser = /** @type {import('node:stream').Readable} */ (
56
+ browser.stdio[4]
57
+ );
58
+
59
+ let next = 1;
60
+ /** @type {Map<number, {resolve: (v: any) => void, reject: (e: Error) => void}>} */
61
+ const waiting = new Map();
62
+ /** @type {Array<{method: string, sessionId?: string, resolve: (v: any) => void}>} */
63
+ const listeners = [];
64
+ let buffer = '';
65
+ fromBrowser.setEncoding('utf8');
66
+ fromBrowser.on('data', chunk => {
67
+ buffer += chunk;
68
+ let end;
69
+ while ((end = buffer.indexOf('\0')) >= 0) {
70
+ const msg = JSON.parse(buffer.slice(0, end));
71
+ buffer = buffer.slice(end + 1);
72
+ if (msg.id && waiting.has(msg.id)) {
73
+ const w = /** @type {any} */ (waiting.get(msg.id));
74
+ waiting.delete(msg.id);
75
+ if (msg.error) w.reject(new Error(msg.error.message));
76
+ else w.resolve(msg.result);
77
+ } else if (msg.method) {
78
+ const i = listeners.findIndex(
79
+ l => l.method === msg.method && l.sessionId === msg.sessionId,
80
+ );
81
+ if (i >= 0) listeners.splice(i, 1)[0].resolve(msg.params);
82
+ }
83
+ }
84
+ });
85
+
86
+ const gone = new Promise((_, reject) => {
87
+ browser.on('close', code =>
88
+ reject(
89
+ new Error(
90
+ stderr.trim() ||
91
+ `the browser stopped (exit ${code}) before the picture`,
92
+ ),
93
+ ),
94
+ );
95
+ // A browser that cannot be started at all (not there, not runnable).
96
+ browser.on('error', e => reject(e));
97
+ });
98
+ gone.catch(() => {});
99
+ // A browser that ends early closes its pipes: a write to it then fails
100
+ // with EPIPE. That is no error of its own: the browser's close (and its
101
+ // stderr, which names the cause) is the reason given.
102
+ toBrowser.on('error', () => {});
103
+ fromBrowser.on('error', () => {});
104
+
105
+ /**
106
+ * One protocol call, answered or failed with the browser.
107
+ * @param {string} method
108
+ * @param {object} [params]
109
+ * @param {string} [sessionId]
110
+ * @returns {Promise<any>}
111
+ */
112
+ function send(method, params = {}, sessionId) {
113
+ const id = next++;
114
+ const answer = new Promise((resolve, reject) =>
115
+ waiting.set(id, {resolve, reject}),
116
+ );
117
+ toBrowser.write(
118
+ `${JSON.stringify({id, method, params, ...(sessionId ? {sessionId} : {})})}\0`,
119
+ );
120
+ return Promise.race([answer, gone]);
121
+ }
122
+
123
+ /**
124
+ * The next event of a kind in a session.
125
+ * @param {string} method
126
+ * @param {string} sessionId
127
+ */
128
+ function event(method, sessionId) {
129
+ return Promise.race([
130
+ new Promise(resolve => listeners.push({method, sessionId, resolve})),
131
+ gone,
132
+ ]);
133
+ }
134
+
135
+ try {
136
+ const {targetId} = await send('Target.createTarget', {url: 'about:blank'});
137
+ const {sessionId} = await send('Target.attachToTarget', {
138
+ targetId,
139
+ flatten: true,
140
+ });
141
+ await send('Page.enable', {}, sessionId);
142
+ await send(
143
+ 'Emulation.setDeviceMetricsOverride',
144
+ {width: 1280, height: 900, deviceScaleFactor: 1, mobile: false},
145
+ sessionId,
146
+ );
147
+ await send(
148
+ 'Emulation.setEmulatedMedia',
149
+ {
150
+ features: [
151
+ {
152
+ name: 'prefers-color-scheme',
153
+ value: mode === 'dark' ? 'dark' : 'light',
154
+ },
155
+ ],
156
+ },
157
+ sessionId,
158
+ );
159
+ const loaded = event('Page.loadEventFired', sessionId);
160
+ await send('Page.navigate', {url: pathToFileURL(html).href}, sessionId);
161
+ await loaded;
162
+ const metrics = await send('Page.getLayoutMetrics', {}, sessionId);
163
+ const size = metrics.cssContentSize ?? metrics.contentSize;
164
+ const {data} = await send(
165
+ 'Page.captureScreenshot',
166
+ {
167
+ format: 'png',
168
+ captureBeyondViewport: true,
169
+ clip: {
170
+ x: 0,
171
+ y: 0,
172
+ width: 1280,
173
+ height: Math.max(1, Math.ceil(size.height)),
174
+ scale: 1,
175
+ },
176
+ },
177
+ sessionId,
178
+ );
179
+ fs.writeFileSync(png, Buffer.from(data, 'base64'));
180
+ await send('Browser.close').catch(() => {});
181
+ } catch (e) {
182
+ process.stderr.write(`${e instanceof Error ? e.message : String(e)}\n`);
183
+ process.exitCode = 1;
184
+ browser.kill('SIGKILL');
185
+ }
@@ -0,0 +1,4 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ export {};
@@ -0,0 +1,34 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file One picture of a page through the project's Playwright, run as its
5
+ * own process by the editor's browser runner.
6
+ * @input argv: the Playwright entry file, the page (.html), the picture
7
+ * (.png), the color mode, and a browser to use instead of Playwright's own
8
+ * @output the picture at the path given; on failure, Playwright's error on
9
+ * stderr and exit code 1
10
+ * @position run by `screenshot` in api/theme-edit/_preview.mjs through
11
+ * `runBrowser`, which gives it a temp folder of its own, its time bound and its stop
12
+ */
13
+
14
+ import {pathToFileURL} from 'node:url';
15
+
16
+ const [entry, html, png, mode, executablePath] = process.argv.slice(2);
17
+ try {
18
+ const pw = await import(pathToFileURL(entry).href);
19
+ const chromium = pw.chromium ?? pw.default?.chromium;
20
+ const browser = await chromium.launch(executablePath ? {executablePath} : {});
21
+ try {
22
+ const page = await browser.newPage({
23
+ viewport: {width: 1280, height: 900},
24
+ colorScheme: mode === 'dark' ? 'dark' : 'light',
25
+ });
26
+ await page.goto(pathToFileURL(html).href, {waitUntil: 'load'});
27
+ await page.screenshot({path: png, fullPage: true});
28
+ } finally {
29
+ await browser.close();
30
+ }
31
+ } catch (e) {
32
+ process.stderr.write(`${e instanceof Error ? e.message : String(e)}\n`);
33
+ process.exitCode = 1;
34
+ }
@@ -13,6 +13,7 @@
13
13
 
14
14
  import {astryxClass, decode, find, FORM_TAGS, hasTag, isEl, parseHtml, textOf, VOID} from './html-reader.mjs';
15
15
  import {componentMap, pascal} from './component-map.mjs';
16
+ import {compareText} from '../text/compare-text.mjs';
16
17
 
17
18
  /** @typedef {import('./html-reader.mjs').ElementNode} ElementNode */
18
19
  /** @typedef {import('./html-reader.mjs').Node} Node */
@@ -240,7 +241,7 @@ export function rebuildPage(html, fromDir) {
240
241
 
241
242
  const lines = body.children.flatMap(c => emit(c, ' '));
242
243
  const importLines = [...imports.entries()]
243
- .sort(([a], [b]) => a.localeCompare(b))
244
+ .sort(([a], [b]) => compareText(a, b))
244
245
  .map(([mod, names]) => `import {${[...names].sort().join(', ')}} from '${mod}';`);
245
246
  const title = decode(textOf(find(doc, 'title') ?? {text: ''})).trim();
246
247
  const source = [
@@ -1,6 +1,30 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * Run `use` with a state file for one host in a new folder under the system's
6
+ * temporary folder, never in the project, and remove the folder after. The
7
+ * state file only explains a failure: without a temporary folder, `use` gets
8
+ * none and the render runs without it.
9
+ * @template T
10
+ * @param {(stateFile: string | undefined) => Promise<T>} use
11
+ * @param {{makeTempDir?: (prefix: string) => string}} [options]
12
+ * @returns {Promise<T>}
13
+ */
14
+ export function withHostStateFile<T>(use: (stateFile: string | undefined) => Promise<T>, { makeTempDir }?: {
15
+ makeTempDir?: (prefix: string) => string;
16
+ }): Promise<T>;
17
+ /**
18
+ * The page's answer from its host process, or the reason it has none.
19
+ * @param {import('node:child_process').ChildProcess} host
20
+ * @param {{timeoutMs: number, withoutSegmenter: boolean, stateFile?: string}} options
21
+ * @returns {Promise<any>}
22
+ */
23
+ export function awaitHost(host: import("node:child_process").ChildProcess, { timeoutMs, withoutSegmenter, stateFile }: {
24
+ timeoutMs: number;
25
+ withoutSegmenter: boolean;
26
+ stateFile?: string;
27
+ }): Promise<any>;
4
28
  /**
5
29
  * The warning for a page rendered without Intl.Segmenter.
6
30
  * @returns {RenderWarning}
@@ -9,9 +33,15 @@ export function segmenterWarning(): RenderWarning;
9
33
  /**
10
34
  * Render a page module to one self-contained HTML file.
11
35
  * @param {string} entry absolute path of the page module
12
- * @param {{title?: string, timeoutMs?: number, version?: string, served?: ServedSet | null}} [options]
36
+ * @param {{title?: string, timeoutMs?: number, version?: string, served?: ServedSet | null, output?: string, cwd?: string}} [options]
13
37
  * `served`: the Core of the package set the CLI runs from, for the packages
14
- * the page's folder has no copy of
38
+ * the page's folder has no copy of; `output`: the file the HTML goes to;
39
+ * `cwd`: the current folder, whose files are the page's own outside a
40
+ * project.
41
+ * With `output`, the file describes itself: notes at its top and end name
42
+ * what made it and the commands that give the page back and render it
43
+ * again, and its embedded source records the CLI version, the packages
44
+ * the page rendered with, and the markup as rendered.
15
45
  * @returns {Promise<RenderedPage>}
16
46
  */
17
47
  export function renderPage(entry: string, options?: {
@@ -19,10 +49,11 @@ export function renderPage(entry: string, options?: {
19
49
  timeoutMs?: number;
20
50
  version?: string;
21
51
  served?: ServedSet | null;
52
+ output?: string;
53
+ cwd?: string;
22
54
  }): Promise<RenderedPage>;
23
55
  /** How long one page may take to render before it is stopped. */
24
56
  export const RENDER_TIMEOUT_MS: 60000;
25
- export { PAGE_EXTENSIONS } from "./embedded-files.mjs";
26
57
  /**
27
58
  * @typedef {object} RenderWarning
28
59
  * @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'not-embedded' | 'node-crash'} code - What kind of problem.
@@ -103,3 +134,4 @@ export type ServedSet = {
103
134
  dir: string;
104
135
  integrations: readonly string[];
105
136
  };
137
+ export { MODULE_EXTENSIONS, PAGE_EXTENSIONS } from "./embedded-files.mjs";