@astryxdesign/cli 0.7.10 → 0.7.11-canary.9782dea

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 (66) hide show
  1. package/api/build/blocks/blocks.weights.json +1 -1
  2. package/api/build/build.doc.mjs +1 -1
  3. package/api/build/kit/signals.mjs +9 -3
  4. package/api/build/kit/start.d.mts +19 -0
  5. package/api/build/kit/start.mjs +49 -2
  6. package/api/build/kit/weights.d.mts +12 -0
  7. package/api/build/kit/weights.mjs +52 -16
  8. package/api/docs/_adapter.mjs +2 -1
  9. package/api/doctor/_adapter.d.mts +28 -1
  10. package/api/doctor/_adapter.mjs +39 -2
  11. package/api/doctor/doctor.doc.mjs +1 -1
  12. package/api/doctor/doctor.mjs +9 -2
  13. package/api/doctor/theme-checks.d.mts +44 -3
  14. package/api/doctor/theme-checks.mjs +273 -6
  15. package/api/hook/hook.mjs +13 -0
  16. package/api/integration/pack-check.d.mts +8 -6
  17. package/api/integration/pack-check.mjs +16 -6
  18. package/api/render/_adapter.mjs +47 -1
  19. package/api/render/render.doc.mjs +2 -1
  20. package/api/search/_gather-components.mjs +2 -1
  21. package/api/swizzle/copy/copy.mjs +5 -1
  22. package/api/theme/build/build.mjs +15 -4
  23. package/assets/docs/author-a-theme.doc.mjs +2 -0
  24. package/assets/docs/getting-started.doc.mjs +20 -0
  25. package/assets/docs/tree/building-blocks.doc.mjs +1 -0
  26. package/assets/docs/tree/global-integrations.doc.mjs +1 -0
  27. package/assets/docs/tree/help.doc.mjs +1 -1
  28. package/assets/docs/tree/quick-start.doc.mjs +1 -0
  29. package/assets/docs/tree/render-pages.doc.mjs +1 -1
  30. package/assets/docs/tree/ship.doc.mjs +1 -1
  31. package/assets/docs/tree/tokens-color.doc.mjs +2 -2
  32. package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.doc.mjs +15 -0
  33. package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.tsx +134 -0
  34. package/authoring/doctypes/_schema.d.mts +1 -1
  35. package/clients/cli/commands/build.doc.mjs +3 -2
  36. package/clients/cli/commands/build.mjs +34 -5
  37. package/clients/cli/index.mjs +36 -7
  38. package/foundation/discovery/authoring-self-docs.mjs +8 -3
  39. package/foundation/discovery/cli-self-docs.mjs +2 -1
  40. package/foundation/discovery/component-discovery.mjs +16 -0
  41. package/foundation/discovery/docs-discovery.mjs +6 -4
  42. package/foundation/discovery/icon-definition-discovery.mjs +3 -3
  43. package/foundation/discovery/module-exports.d.mts +91 -4
  44. package/foundation/discovery/module-exports.mjs +316 -42
  45. package/foundation/discovery/template-adapter.mjs +5 -7
  46. package/foundation/discovery/theme-discovery.mjs +8 -10
  47. package/foundation/doc-compiler/tree.mjs +2 -2
  48. package/foundation/env/package-manager.d.mts +12 -4
  49. package/foundation/env/package-manager.mjs +15 -6
  50. package/foundation/env/semver.mjs +41 -9
  51. package/foundation/fs/listing-cache.d.mts +3 -1
  52. package/foundation/fs/listing-cache.mjs +63 -11
  53. package/foundation/fs/paths.mjs +2 -1
  54. package/foundation/release/notices.d.mts +16 -0
  55. package/foundation/release/notices.mjs +27 -6
  56. package/foundation/render/embedded-imports.d.mts +7 -0
  57. package/foundation/render/embedded-imports.mjs +1 -1
  58. package/foundation/render/page-worker.mjs +109 -4
  59. package/foundation/render/render-page.d.mts +16 -1
  60. package/foundation/render/render-page.mjs +25 -18
  61. package/foundation/render/served-packages.d.mts +33 -0
  62. package/foundation/render/served-packages.mjs +75 -0
  63. package/foundation/render/single-copy-hooks.d.mts +18 -0
  64. package/foundation/render/single-copy-hooks.mjs +44 -0
  65. package/foundation/text/string-utils.mjs +25 -25
  66. package/package.json +6 -6
@@ -9,7 +9,7 @@ export const docs = {
9
9
  placement: {parent: 'namespace:authoring', slot: 'guides', order: 30},
10
10
  title: 'Ship',
11
11
  summary: 'Test, publish, and upgrade your package.',
12
- keywords: ['ship', 'publish', 'release', 'upgrade'],
12
+ keywords: ['authoring', 'ship', 'publish', 'release', 'upgrade'],
13
13
  slots: {
14
14
  guides: {title: 'Ship', accepts: {kinds: ['generic']}},
15
15
  },
@@ -45,7 +45,7 @@ export const docs = {
45
45
  ],
46
46
  [
47
47
  "--color-icon-<status>",
48
- "Status icons on the page or a card. Defaults to the text colour.",
48
+ "Status icons and marks on the page or a card, such as a StatusDot. Defaults to the text colour.",
49
49
  "—"
50
50
  ],
51
51
  [
@@ -55,7 +55,7 @@ export const docs = {
55
55
  ],
56
56
  [
57
57
  "--color-<status>",
58
- "Strong status fill, such as a Badge or StatusDot.",
58
+ "Strong status fill, such as a Badge.",
59
59
  "--color-on-<status>"
60
60
  ],
61
61
  [
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useTableSelectionState',
7
+ alsoExampleFor: ['Table'],
8
+ name: 'Table — Selection in the Leading Mark',
9
+ displayName: 'Table — Selection in the Leading Mark',
10
+ description:
11
+ 'Selection without a checkbox column: each item shows its avatar, and the checkbox takes the avatar slot while a mouse is over it, on keyboard focus, and everywhere once anything is selected; on touch screens it always shows. The state comes from useTableSelectionState, and the checkboxes render in the name column instead of the useTableSelection column, so checked items get no aria-selected or highlight; add them if needed.',
12
+ isReady: true,
13
+ aspectRatio: 16 / 9,
14
+ componentsUsed: ['Table', 'CheckboxInput', 'Avatar'],
15
+ };
@@ -0,0 +1,134 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import * as stylex from '@stylexjs/stylex';
7
+ import {Avatar} from '@astryxdesign/core/Avatar';
8
+ import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
9
+ import {HStack} from '@astryxdesign/core/HStack';
10
+ import {useContainerReveal} from '@astryxdesign/core/hooks';
11
+ import {
12
+ Table,
13
+ proportional,
14
+ useTableSelectionState,
15
+ } from '@astryxdesign/core/Table';
16
+ import type {TableColumn} from '@astryxdesign/core/Table';
17
+ import {colorVars, spacingVars} from '@astryxdesign/core/theme/tokens.stylex';
18
+ import {mergeProps} from '@astryxdesign/core/utils';
19
+
20
+ interface Automation extends Record<string, unknown> {
21
+ id: string;
22
+ name: string;
23
+ owner: string;
24
+ schedule: string;
25
+ }
26
+
27
+ const automations: Automation[] = [
28
+ {id: '1', name: 'Nightly backup', owner: 'Alice', schedule: 'Daily, 2:00'},
29
+ {id: '2', name: 'Weekly digest', owner: 'Bob', schedule: 'Mondays, 9:00'},
30
+ {id: '3', name: 'Cache warmup', owner: 'Diana', schedule: 'Hourly'},
31
+ {id: '4', name: 'Usage report', owner: 'Eve', schedule: 'Monthly, 1st'},
32
+ ];
33
+
34
+ const styles = stylex.create({
35
+ mark: {
36
+ display: 'grid',
37
+ placeItems: 'center',
38
+ flexShrink: 0,
39
+ },
40
+ // A flex layer is exactly as tall as the 24px avatar; a block layer
41
+ // follows the taller line box and lets the avatar's edge show under the
42
+ // checkbox.
43
+ layer: {
44
+ gridArea: '1 / 1',
45
+ display: 'flex',
46
+ },
47
+ // The checkbox covers the avatar while it shows, so the two never read as
48
+ // one mark.
49
+ checkbox: {
50
+ borderRadius: '50%',
51
+ backgroundColor: colorVars['--color-background-surface'],
52
+ },
53
+ name: {
54
+ paddingInlineStart: spacingVars['--spacing-1'],
55
+ },
56
+ });
57
+
58
+ export default function TableLeadingMarkSelection() {
59
+ const [selectedKeys, setSelectedKeys] = useState<Set<string>>(new Set());
60
+ // The mark reveals its checkbox on hover and keyboard focus, and always
61
+ // shows it on touch.
62
+ const {getContainerProps, getContentRevealProps} = useContainerReveal();
63
+ const {selectionConfig, selectionState} = useTableSelectionState<Automation>({
64
+ data: automations,
65
+ idKey: 'id',
66
+ selectedKeys,
67
+ setSelectedKeys,
68
+ });
69
+
70
+ const columns: TableColumn<Automation>[] = [
71
+ {
72
+ key: 'name',
73
+ header: (
74
+ <HStack gap={2} vAlign="center">
75
+ <CheckboxInput
76
+ label="Select all automations"
77
+ isLabelHidden
78
+ value={
79
+ selectionConfig.getIsAllSelected()
80
+ ? true
81
+ : selectionConfig.getIsIndeterminate?.()
82
+ ? 'indeterminate'
83
+ : false
84
+ }
85
+ onChange={checked =>
86
+ selectionConfig.onSelectAll({isAllSelected: checked})
87
+ }
88
+ />
89
+ Automation
90
+ </HStack>
91
+ ),
92
+ width: proportional(2),
93
+ renderCell: item => {
94
+ const isSelected = selectionConfig.getIsItemSelected(item);
95
+ return (
96
+ <HStack gap={2} vAlign="center">
97
+ <span
98
+ {...mergeProps(stylex.props(styles.mark), getContainerProps())}>
99
+ {selectionState.hasSelection ? null : (
100
+ <span {...stylex.props(styles.layer)}>
101
+ <Avatar name={item.owner} size="sm" tooltip={false} />
102
+ </span>
103
+ )}
104
+ <span
105
+ {...mergeProps(
106
+ stylex.props(styles.layer, styles.checkbox),
107
+ getContentRevealProps({
108
+ isLayoutPreserved: true,
109
+ forceVisibility: selectionState.hasSelection
110
+ ? 'shown'
111
+ : undefined,
112
+ }),
113
+ )}>
114
+ <CheckboxInput
115
+ label={`Select ${item.name}`}
116
+ isLabelHidden
117
+ value={isSelected}
118
+ onChange={checked =>
119
+ selectionConfig.onSelectItem({item, isSelected: checked})
120
+ }
121
+ />
122
+ </span>
123
+ </span>
124
+ <span {...stylex.props(styles.name)}>{item.name}</span>
125
+ </HStack>
126
+ );
127
+ },
128
+ },
129
+ {key: 'owner', header: 'Owner', width: proportional(1)},
130
+ {key: 'schedule', header: 'Schedule', width: proportional(1)},
131
+ ];
132
+
133
+ return <Table data={automations} columns={columns} idKey="id" />;
134
+ }
@@ -510,9 +510,9 @@ export const CommandDocKindSchema: z.ZodObject<{
510
510
  when: z.ZodString;
511
511
  }, z.core.$loose>>>;
512
512
  outsideProject: z.ZodOptional<z.ZodEnum<{
513
+ own: "own";
513
514
  same: "same";
514
515
  refuse: "refuse";
515
- own: "own";
516
516
  }>>;
517
517
  related: z.ZodOptional<z.ZodArray<z.ZodString>>;
518
518
  notes: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -26,8 +26,9 @@ export const doc = {
26
26
  {
27
27
  flag: '--type <domain>',
28
28
  param: 'options.type',
29
- choices: ['component', 'hook', 'template'],
30
- description: 'Filter the kit to one domain (component|hook|template)',
29
+ choices: ['component', 'hook', 'doc', 'template', 'theme'],
30
+ description:
31
+ 'Filter the kit to one domain (component|hook|doc|template|theme); doc and theme give an empty kit',
31
32
  },
32
33
  {
33
34
  flag: '--limit <n>',
@@ -66,6 +66,24 @@ function printPlaybook(playbook) {
66
66
  );
67
67
  }
68
68
 
69
+ /** The domains search finds that a build kit has no group for. */
70
+ const SEARCH_ONLY_TYPES = ['doc', 'theme'];
71
+
72
+ /**
73
+ * In text mode, say once on stderr that a kit has no docs or themes and name
74
+ * the search that finds them, as other command notes do (`search`,
75
+ * `integration pack --check`). Stdout, the JSON envelope and the exit status
76
+ * stay as they are.
77
+ * @param {string | undefined} type
78
+ * @param {boolean} json
79
+ */
80
+ function pointToSearch(type, json) {
81
+ if (json || !type || !SEARCH_ONLY_TYPES.includes(type)) return;
82
+ console.error(
83
+ `Note: a build kit has no ${type}s. Find them with \`${formatCliCommand(`search <query> --type ${type}`)}\`.`,
84
+ );
85
+ }
86
+
69
87
  /**
70
88
  * @param {import('commander').Command} program
71
89
  */
@@ -89,6 +107,7 @@ export function registerBuild(program) {
89
107
  // one. Counting it as a result keeps "what did this run answer with"
90
108
  // true for the no-argument form too.
91
109
  const playbook = resultSet({count: 1, resultKind: 'doc'});
110
+ pointToSearch(options.type, json);
92
111
  if (json) {
93
112
  jsonOut(result);
94
113
  return playbook;
@@ -101,8 +120,7 @@ export function registerBuild(program) {
101
120
  // Parse --limit to a number; the API validates it (positive integer) and
102
121
  // throws ERR_INVALID_ARGUMENT, so we pass NaN through rather than
103
122
  // pre-rejecting with a generic code here (parity with `search`).
104
- const limit =
105
- options.limit != null ? Number(options.limit) : 60;
123
+ const limit = options.limit != null ? Number(options.limit) : 60;
106
124
 
107
125
  /** @type {import('../../../api/build/build.type.mjs').BuildKitResponse} */
108
126
  let result;
@@ -151,6 +169,7 @@ export function registerBuild(program) {
151
169
  jsonOut(result);
152
170
  return answered;
153
171
  }
172
+ pointToSearch(options.type, json);
154
173
 
155
174
  if (!hasResults && !start) {
156
175
  emit(
@@ -227,7 +246,13 @@ export function registerBuild(program) {
227
246
  start,
228
247
  verbose
229
248
  ? {
230
- fields: ['name', 'package', 'displayName', 'description', 'command'],
249
+ fields: [
250
+ 'name',
251
+ 'package',
252
+ 'displayName',
253
+ 'description',
254
+ 'command',
255
+ ],
231
256
  format: {command: formatCliCommand},
232
257
  }
233
258
  : brief(['name', 'package', 'description', 'command']),
@@ -242,7 +267,9 @@ export function registerBuild(program) {
242
267
  ),
243
268
  records(
244
269
  start.alternatives,
245
- verbose ? full : brief(['name', 'package', 'description', 'command']),
270
+ verbose
271
+ ? full
272
+ : brief(['name', 'package', 'description', 'command']),
246
273
  ),
247
274
  );
248
275
  }
@@ -283,7 +310,9 @@ export function registerBuild(program) {
283
310
  ? [
284
311
  records(
285
312
  shown(domain),
286
- verbose ? full : brief(['name', 'package', 'deprecated', 'description']),
313
+ verbose
314
+ ? full
315
+ : brief(['name', 'package', 'deprecated', 'description']),
287
316
  ),
288
317
  ]
289
318
  : []),
@@ -22,7 +22,8 @@ import {isOutsideProject} from '../../foundation/env/project-scope.mjs';
22
22
  import {findConfigPath} from '../../foundation/config/config-path.mjs';
23
23
  import {API_VERSION, setJsonMode} from '../../foundation/response/json.mjs';
24
24
  import {answeredBy, runChoice} from '../../foundation/release/run-context.mjs';
25
- import {cliInstallAdvice, installFolder} from '../../foundation/release/notices.mjs';
25
+ import {cliInstallAdvice, installFolder, projectRelease, SETUP_REMINDER_KEY, takeNotice} from '../../foundation/release/notices.mjs';
26
+ import {isCi} from '../../foundation/release/update-notice-env.mjs';
26
27
  import {buildManifest} from './lib/manifest.mjs';
27
28
  import {cliError} from './lib/cli-error.mjs';
28
29
  import {section, text, records} from './formatters/index.mjs';
@@ -683,8 +684,11 @@ export async function createProgram({argv} = {}) {
683
684
  * repository root — see isAstryxPromptInReach), remind the user/agent that
684
685
  * setup is missing.
685
686
  *
686
- * Uses `preAction` (not postAction) so it fires for EVERY valid command — even
687
- * ones whose action errors or calls process.exit (postAction is skipped then).
687
+ * `preAction` decides the line; `postAction` prints it after a command that
688
+ * succeeds, at most once a day per project, recorded in the per-user state
689
+ * as the daily hint is, and never under CI. An agent that leaves `init` to
690
+ * its person then sees it once, not before every command. Doctor reports
691
+ * the missing setup in its own check every time.
688
692
  *
689
693
  * Suppressed in --json: that is machine output with a strict clean stdout+stderr
690
694
  * contract (json-shim.test: "error envelopes have empty stderr"), and --json
@@ -695,8 +699,29 @@ export async function createProgram({argv} = {}) {
695
699
  * or one that neither installs nor declares Astryx), and inside the CLI's own
696
700
  * source checkout when it runs from there.
697
701
  */
702
+ /** @type {{root: string, line: string} | null} */
703
+ let setupReminder = null;
704
+ /**
705
+ * Keep the reminder for `root` until the command ends.
706
+ * @param {string} root
707
+ * @param {string} line
708
+ */
709
+ const remindSetup = (root, line) => {
710
+ setupReminder = {root, line};
711
+ };
712
+ program.hook('postAction', () => {
713
+ try {
714
+ const reminder = setupReminder;
715
+ setupReminder = null;
716
+ if (reminder == null || process.exitCode || isCi(process.env)) return;
717
+ if (takeNotice(`${SETUP_REMINDER_KEY}${reminder.root}`)) console.error(reminder.line);
718
+ } catch {
719
+ // Never let the nudge break a command.
720
+ }
721
+ });
698
722
  program.hook('preAction', (thisCommand, actionCommand) => {
699
723
  try {
724
+ setupReminder = null;
700
725
  if (program.opts().json) return; // machine mode — keep --json output clean
701
726
  if (SETUP_NUDGE_EXEMPT.has(actionCommand.name())) return;
702
727
  const cwd = process.cwd();
@@ -738,9 +763,12 @@ export async function createProgram({argv} = {}) {
738
763
  // before it, so the command is the picker's for that folder, never the
739
764
  // bare `astryx` name a package runner would fetch from the registry
740
765
  // (spec AST-081 FR5).
766
+ // The command names the project's release, as run from its folder,
767
+ // never the Core this folder installs for itself.
741
768
  if (target.moved) {
742
- console.error(
743
- setupNudge(getCliInvocation(target.dir), {before: `cd ${quoteCommandArgument(target.dir)}`}).trimEnd(),
769
+ remindSetup(
770
+ target.dir,
771
+ setupNudge(getCliInvocation(target.dir, {release: projectRelease(target.dir)}), {before: `cd ${quoteCommandArgument(target.dir)}`}).trimEnd(),
744
772
  );
745
773
  return;
746
774
  }
@@ -750,13 +778,14 @@ export async function createProgram({argv} = {}) {
750
778
  // version, then run that CLI's init.
751
779
  const add = cliInstallAdvice({cwd, core: choice.coreVersion});
752
780
  if (add?.command) {
753
- console.error(
781
+ remindSetup(
782
+ add.root,
754
783
  setupNudge(getCliInvocation(add.root, {installed: true}), {before: add.command}).trimEnd(),
755
784
  );
756
785
  return;
757
786
  }
758
787
  }
759
- console.error(setupNudge(getCliInvocation(cwd)).trimEnd());
788
+ remindSetup(agentDocsTargetDir(cwd), setupNudge(getCliInvocation(cwd)).trimEnd());
760
789
  } catch {
761
790
  // Never let the nudge break a command.
762
791
  }
@@ -15,9 +15,9 @@
15
15
  * the self-doc tests fail.
16
16
  */
17
17
 
18
- import * as fs from 'node:fs';
19
18
  import * as path from 'node:path';
20
19
  import {CLI_ROOT} from '../fs/paths.mjs';
20
+ import {listDirEntries} from '../fs/listing-cache.mjs';
21
21
  import {readDocView} from '../doc-compiler/read.mjs';
22
22
  import {
23
23
  DOC_OUTPUT_BUDGET_BYTES,
@@ -75,7 +75,7 @@ export function discoverAuthoringSelfDocSources(root = AUTHORING_ROOT) {
75
75
  const found = [];
76
76
  /** @param {string} dir */
77
77
  const walk = dir => {
78
- for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
78
+ for (const entry of listDirEntries(dir)) {
79
79
  if (entry.name === 'node_modules' || entry.name.startsWith('__'))
80
80
  continue;
81
81
  const full = path.join(dir, entry.name);
@@ -229,7 +229,12 @@ export function buildAuthoringReferenceDoc(docs) {
229
229
  placement: {parent: 'namespace:authoring', slot: 'reference', order: 10},
230
230
  title: 'Field reference',
231
231
  category: 'guide',
232
- keywords: ['authoring reference', 'field reference', 'every field'],
232
+ keywords: [
233
+ 'authoring',
234
+ 'authoring reference',
235
+ 'field reference',
236
+ 'every field',
237
+ ],
233
238
  description:
234
239
  'Every file an integration author writes, field by field: the integration manifest, astryx.config, codemods, identity, and each doc type. The guides that use them are the rest of {@link namespace:authoring}.',
235
240
  sections: docs
@@ -18,6 +18,7 @@
18
18
  import * as fs from 'node:fs';
19
19
  import * as path from 'node:path';
20
20
  import {CLI_ROOT} from '../fs/paths.mjs';
21
+ import {listDirEntries} from '../fs/listing-cache.mjs';
21
22
  import {readDocView} from '../doc-compiler/read.mjs';
22
23
  import {AUTHORING_SELF_DOCS, selfDocSection} from './authoring-self-docs.mjs';
23
24
  import {
@@ -66,7 +67,7 @@ export function discoverCliSelfDocSources(root = CLI_ROOT) {
66
67
  /** @param {string} dir */
67
68
  const walk = dir => {
68
69
  if (!fs.existsSync(dir)) return;
69
- for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
70
+ for (const entry of listDirEntries(dir)) {
70
71
  if (
71
72
  entry.name === 'node_modules' ||
72
73
  entry.name.startsWith('__') ||
@@ -381,6 +381,22 @@ export function familyMember(docs, name) {
381
381
  * @returns {Record<string, string[]>}
382
382
  */
383
383
  export function discoverComponents(coreDir) {
384
+ // The component matcher calls this for each name it resolves, so one
385
+ // operation reads the docs once. Each caller gets its own copy to change.
386
+ const found = oncePerListing(`components\0${coreDir}`, () =>
387
+ readComponentGroups(coreDir),
388
+ );
389
+ return Object.fromEntries(
390
+ Object.entries(found).map(([key, names]) => [key, [...names]]),
391
+ );
392
+ }
393
+
394
+ /**
395
+ * The component groups under `coreDir`, read from disk.
396
+ * @param {string} coreDir
397
+ * @returns {Record<string, string[]>}
398
+ */
399
+ function readComponentGroups(coreDir) {
384
400
  const srcDir = path.join(coreDir, 'src');
385
401
  /** @type {Map<string, string|null>} componentName → group */
386
402
  const componentGroups = new Map();
@@ -32,6 +32,7 @@
32
32
  import * as fs from 'node:fs';
33
33
  import * as path from 'node:path';
34
34
  import {CLI_ROOT} from '../fs/paths.mjs';
35
+ import {listDir, listDirEntries} from '../fs/listing-cache.mjs';
35
36
  import {importDocModule} from '../doc-compiler/import.mjs';
36
37
  import {CLI_PROVIDER_ID} from '../identity/providers.mjs';
37
38
  import {parseReadableDoc} from '../doc-compiler/parse-readable.mjs';
@@ -135,7 +136,7 @@ export function discoverBuiltinTopics() {
135
136
  /** @type {Record<string, string>} */
136
137
  const topics = Object.create(null);
137
138
  if (!fs.existsSync(BUILTIN_DOCS_DIR)) return topics;
138
- for (const file of fs.readdirSync(BUILTIN_DOCS_DIR)) {
139
+ for (const file of listDir(BUILTIN_DOCS_DIR)) {
139
140
  const match = file.match(BUILTIN_TOPIC_FILE_RE);
140
141
  if (match) topics[match[1]] = path.join(BUILTIN_DOCS_DIR, file);
141
142
  }
@@ -152,7 +153,7 @@ export function builtinGuideFiles() {
152
153
  const files = Object.values(discoverBuiltinTopics());
153
154
  const tree = path.join(BUILTIN_DOCS_DIR, 'tree');
154
155
  if (fs.existsSync(tree)) {
155
- for (const file of fs.readdirSync(tree).sort()) {
156
+ for (const file of listDir(tree).sort()) {
156
157
  if (BUILTIN_TOPIC_FILE_RE.test(file)) files.push(path.join(tree, file));
157
158
  }
158
159
  }
@@ -524,7 +525,7 @@ export async function discoverIntegrationDocs(integration) {
524
525
  const files = [];
525
526
  /** @param {string} dirPath */
526
527
  function scanDir(dirPath) {
527
- for (const entry of fs.readdirSync(dirPath, {withFileTypes: true})) {
528
+ for (const entry of listDirEntries(dirPath)) {
528
529
  if (entry.name === 'node_modules' || entry.name === '__tests__') continue;
529
530
  const full = path.join(dirPath, entry.name);
530
531
  if (entry.isDirectory()) {
@@ -737,7 +738,8 @@ export function mergeTopicReport(base, overlay) {
737
738
  // It also keeps the place an earlier `after` gave the one it replaces,
738
739
  // so sections placed after that key later still follow it.
739
740
  if (replaced[PLACED_AFTER] != null) {
740
- const placed = replacing === section ? withoutPosition({...section}) : replacing;
741
+ const placed =
742
+ replacing === section ? withoutPosition({...section}) : replacing;
741
743
  for (const symbol of Object.getOwnPropertySymbols(section)) {
742
744
  if (!(symbol in placed)) {
743
745
  Object.defineProperty(
@@ -15,10 +15,10 @@
15
15
  * surface reads
16
16
  */
17
17
 
18
- import * as fs from 'node:fs';
19
18
  import * as path from 'node:path';
20
19
  import {parseIconDefinition} from '../../authoring/doctypes/icon-definition/parse.mjs';
21
20
  import {CLI_ROOT} from '../fs/paths.mjs';
21
+ import {listDirEntries} from '../fs/listing-cache.mjs';
22
22
  import {readStaticDescriptorValue} from './theme-discovery.mjs';
23
23
 
24
24
  /** @typedef {import('../../authoring/doctypes/icon-definition/type').IconDefinitionDoc} IconDefinitionDoc */
@@ -53,10 +53,10 @@ export function readDefinitionsDir(dir, owner) {
53
53
  const definitions = [];
54
54
  /** @type {Array<{file: string, message: string}>} */
55
55
  const errors = [];
56
- /** @type {fs.Dirent[]} */
56
+ /** @type {import('node:fs').Dirent[]} */
57
57
  let entries;
58
58
  try {
59
- entries = fs.readdirSync(dir, {withFileTypes: true});
59
+ entries = listDirEntries(dir);
60
60
  } catch {
61
61
  return {definitions, errors};
62
62
  }