@astryxdesign/cli 0.7.1-canary.ff40b78 → 0.7.2-canary.01eab6a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +7 -7
- package/api/build/_adapter.d.mts +1 -0
- package/api/build/_adapter.mjs +7 -0
- package/api/build/build.mjs +4 -1
- package/api/component/_adapter.d.mts +41 -1
- package/api/component/_adapter.mjs +93 -7
- package/api/component/component.mjs +22 -5
- package/api/component/component.test.mjs +420 -167
- package/api/component/integration-export-name.test.mjs +644 -0
- package/api/component/list/list.mjs +42 -4
- package/api/gap-report/gap-report.mjs +67 -4
- package/api/integration/_adapter.d.mts +12 -0
- package/api/integration/_adapter.mjs +54 -0
- package/api/integration/add-contribution.component-names.test.mjs +66 -0
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/authoring-checks.mjs +11 -2
- package/api/integration/authoring-checks.test.mjs +39 -0
- package/api/integration/authoring-checks.type.d.mts +9 -0
- package/api/integration/authoring-checks.type.mjs +14 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +21 -5
- package/api/integration/pack-check.mjs +61 -107
- package/api/integration/pack-check.test.mjs +359 -0
- package/api/search/search.d.mts +9 -0
- package/api/search/search.mjs +120 -16
- package/api/search/search.test.mjs +36 -0
- package/api/swizzle/copy/copy.mjs +28 -14
- package/api/template/table-filter-view-tabs.test.mjs +45 -0
- package/api/template/template.test.mjs +120 -3
- package/api/theme/build/build.core-on-demand.test.mjs +113 -0
- package/api/theme/build/build.d.mts +13 -13
- package/api/theme/build/build.family.test.mjs +16 -0
- package/api/theme/build/build.mjs +149 -55
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
- package/assets/docs/getting-started.doc.mjs +0 -10
- package/assets/docs/styling-overview.doc.mjs +54 -15
- package/assets/docs/tree/add-a-component.doc.mjs +10 -0
- package/assets/docs/tree/check-the-props.doc.mjs +145 -0
- package/assets/docs/tree/checks.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +5 -1
- package/assets/docs/tree/component-imports.doc.mjs +8 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/migration-setup.doc.mjs +31 -6
- package/assets/docs/tree/responsive.doc.mjs +37 -0
- package/assets/docs/tree/single-component.doc.mjs +3 -2
- package/assets/docs/tree/tailwind.doc.mjs +12 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +3 -2
- package/assets/docs/tree/tokens-syntax.doc.mjs +20 -0
- package/assets/docs/tree/tokens.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -0
- package/assets/docs/working-with-ai.doc.mjs +43 -4
- package/assets/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx +6 -1
- package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
- package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
- package/assets/templates/pages/detail-page/page.tsx +3 -3
- package/assets/templates/pages/table-filter/page.tsx +3 -2
- package/assets/templates/pages/table-inbox/page.tsx +10 -8
- package/assets/templates/themes/butter/butterTheme.ts +53 -11
- package/assets/templates/themes/chocolate/chocolateTheme.ts +29 -5
- package/assets/templates/themes/gothic/gothicTheme.ts +44 -9
- package/assets/templates/themes/stone/stoneTheme.ts +58 -11
- package/assets/templates/themes/y2k/y2kTheme.ts +60 -10
- package/authoring/doctypes/base/type.ts +6 -0
- package/authoring/doctypes/component/component.doc.mjs +4 -4
- package/authoring/doctypes/component/type.ts +6 -3
- package/clients/cli/commands/build-theme.mjs +32 -4
- package/clients/cli/commands/build-theme.path-safety.test.mjs +84 -0
- package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
- package/clients/cli/commands/build-theme.watch.test.mjs +63 -2
- package/clients/cli/commands/doctor-integration-components.doc.mjs +9 -3
- package/clients/cli/commands/doctor-integration.test.mjs +327 -0
- package/clients/cli/commands/doctor.mjs +74 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/lib/component-format.mjs +5 -1
- package/foundation/discovery/component-discovery.d.mts +190 -10
- package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
- package/foundation/discovery/component-discovery.mjs +889 -80
- package/foundation/discovery/component-discovery.test.mjs +96 -0
- package/foundation/discovery/component-replacement.mjs +18 -0
- package/foundation/discovery/component-replacement.test.mjs +40 -0
- package/foundation/discovery/hook-discovery.mjs +13 -12
- package/foundation/discovery/module-exports.d.mts +27 -0
- package/foundation/discovery/module-exports.mjs +356 -31
- package/foundation/discovery/module-exports.test.mjs +172 -0
- package/foundation/discovery/package-tsconfig.d.mts +14 -0
- package/foundation/discovery/package-tsconfig.mjs +228 -0
- package/foundation/discovery/package-tsconfig.test.mjs +210 -0
- package/foundation/discovery/project-typescript.d.mts +23 -0
- package/foundation/discovery/project-typescript.mjs +61 -0
- package/foundation/discovery/prop-drift.d.mts +220 -0
- package/foundation/discovery/prop-drift.mjs +1765 -0
- package/foundation/discovery/prop-drift.test.mjs +1197 -0
- package/foundation/discovery/template-adapter.mjs +74 -5
- package/foundation/discovery/unresolved-references.d.mts +62 -0
- package/foundation/discovery/unresolved-references.mjs +790 -0
- package/foundation/discovery/unresolved-references.test.mjs +567 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +9 -1
- package/foundation/doc-compiler/inputs.mjs +23 -0
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/fs/listing-cache.d.mts +36 -0
- package/foundation/fs/listing-cache.mjs +95 -0
- package/foundation/fs/listing-cache.test.mjs +88 -0
- package/foundation/fs/paths.mjs +3 -2
- package/foundation/integrations/contribution-inventory.mjs +6 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/xle/registry.mjs +4 -0
- package/foundation/xle/registry.test.mjs +28 -0
- package/package.json +10 -10
|
@@ -16,6 +16,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
16
16
|
import {
|
|
17
17
|
CORE_PACKAGE,
|
|
18
18
|
discoverComponents,
|
|
19
|
+
familyMember,
|
|
19
20
|
findComponentReadme,
|
|
20
21
|
findComponentSource,
|
|
21
22
|
resolveImportPath,
|
|
@@ -121,6 +122,91 @@ describe('discoverComponents (real core)', () => {
|
|
|
121
122
|
expect(discoverComponents(core)).toEqual({});
|
|
122
123
|
});
|
|
123
124
|
|
|
125
|
+
it('lists HStack, VStack and Heading, whose docs live in their family folders', () => {
|
|
126
|
+
// Each has its own folder and import path; Stack's doc documents HStack and
|
|
127
|
+
// VStack as members, and Heading's own doc sits in the Text folder.
|
|
128
|
+
const comps = discoverComponents(CORE);
|
|
129
|
+
expect(comps.Layout).toEqual(expect.arrayContaining(['HStack', 'Stack', 'VStack']));
|
|
130
|
+
expect(comps.Heading).toEqual(['Heading']);
|
|
131
|
+
expect(findComponentReadme(CORE, 'VStack')).toMatch(/[\\/]Stack[\\/]Stack\.doc\.mjs$/);
|
|
132
|
+
expect(findComponentReadme(CORE, 'HStack')).toMatch(/[\\/]Stack[\\/]Stack\.doc\.mjs$/);
|
|
133
|
+
expect(findComponentReadme(CORE, 'Heading')).toMatch(/[\\/]Text[\\/]Heading\.doc\.mjs$/);
|
|
134
|
+
expect(resolveImportPath(CORE, 'VStack')).toBe('@astryxdesign/core/VStack');
|
|
135
|
+
expect(resolveImportPath(CORE, 'Heading')).toBe('@astryxdesign/core/Heading');
|
|
136
|
+
}, SLOW);
|
|
137
|
+
|
|
138
|
+
it('lists a component folder with no doc when its family doc lists it as a member', () => {
|
|
139
|
+
const core = mkTmp('as-cd-family-');
|
|
140
|
+
const write = (rel, text) => {
|
|
141
|
+
fs.mkdirSync(path.dirname(path.join(core, 'src', rel)), {recursive: true});
|
|
142
|
+
fs.writeFileSync(path.join(core, 'src', rel), text);
|
|
143
|
+
};
|
|
144
|
+
write('Stack/Stack.tsx', 'x');
|
|
145
|
+
write('VStack/VStack.tsx', "import {Stack} from '../Stack/Stack';\n");
|
|
146
|
+
write('Prose/Prose.tsx', "import {Stack} from '../Stack/Stack';\n");
|
|
147
|
+
// Listed by Stack's doc, but builds on nothing in Stack's folder.
|
|
148
|
+
write('Orphan/Orphan.tsx', "import {x} from '../utils';\n");
|
|
149
|
+
write(
|
|
150
|
+
'Stack/Stack.doc.mjs',
|
|
151
|
+
'export const docs = {\n' +
|
|
152
|
+
" name: 'Stack',\n" +
|
|
153
|
+
" group: 'Layout',\n" +
|
|
154
|
+
" relatedComponents: ['Prose'],\n" +
|
|
155
|
+
" usage: {description: 'Pair with Prose.', examples: [{code: \"<Prose label='Prose' />\"}]},\n" +
|
|
156
|
+
" components: [{name: 'Stack'}, {name: 'VStack', description: 'Vertical.'}, {name: 'Orphan'}],\n" +
|
|
157
|
+
'};\n',
|
|
158
|
+
);
|
|
159
|
+
expect(discoverComponents(core)).toEqual({Layout: ['Stack', 'VStack']});
|
|
160
|
+
expect(findComponentReadme(core, 'VStack')).toBe(
|
|
161
|
+
path.join(core, 'src', 'Stack', 'Stack.doc.mjs'),
|
|
162
|
+
);
|
|
163
|
+
// Named only in relatedComponents, prose, and an example: not documented.
|
|
164
|
+
expect(findComponentReadme(core, 'Prose')).toBeNull();
|
|
165
|
+
// A family doc is read only from the folders the component imports.
|
|
166
|
+
expect(findComponentReadme(core, 'Orphan')).toBeNull();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('lists a component folder with no doc when its own doc sits in a family folder', () => {
|
|
170
|
+
const core = mkTmp('as-cd-sibling-');
|
|
171
|
+
for (const dir of ['Text', 'Heading']) {
|
|
172
|
+
fs.mkdirSync(path.join(core, 'src', dir), {recursive: true});
|
|
173
|
+
}
|
|
174
|
+
fs.writeFileSync(path.join(core, 'src', 'Text', 'Text.tsx'), 'x');
|
|
175
|
+
fs.writeFileSync(path.join(core, 'src', 'Heading', 'Heading.tsx'), 'x');
|
|
176
|
+
fs.writeFileSync(
|
|
177
|
+
path.join(core, 'src', 'Text', 'Text.doc.mjs'),
|
|
178
|
+
"export const docs = {name: 'Text', components: [{name: 'Heading'}]};\n",
|
|
179
|
+
);
|
|
180
|
+
fs.writeFileSync(
|
|
181
|
+
path.join(core, 'src', 'Text', 'Heading.doc.mjs'),
|
|
182
|
+
"export const docs = {name: 'Heading'};\n",
|
|
183
|
+
);
|
|
184
|
+
expect(discoverComponents(core)).toEqual({Heading: ['Heading'], Text: ['Text']});
|
|
185
|
+
expect(findComponentReadme(core, 'Heading')).toBe(
|
|
186
|
+
path.join(core, 'src', 'Text', 'Heading.doc.mjs'),
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('keeps a member its family hides, and a context folder, unlisted', () => {
|
|
191
|
+
const core = mkTmp('as-cd-family-hidden-');
|
|
192
|
+
for (const dir of ['Stack', 'VStack', 'SizeContext']) {
|
|
193
|
+
fs.mkdirSync(path.join(core, 'src', dir), {recursive: true});
|
|
194
|
+
fs.writeFileSync(
|
|
195
|
+
path.join(core, 'src', dir, `${dir}.tsx`),
|
|
196
|
+
"import {Stack} from '../Stack/Stack';\n",
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
fs.writeFileSync(
|
|
200
|
+
path.join(core, 'src', 'Stack', 'Stack.doc.mjs'),
|
|
201
|
+
'export const docs = {\n' +
|
|
202
|
+
" name: 'Stack',\n" +
|
|
203
|
+
" hiddenComponents: ['VStack'],\n" +
|
|
204
|
+
" components: [{name: 'Stack'}, {name: 'VStack'}, {name: 'SizeContext'}],\n" +
|
|
205
|
+
'};\n',
|
|
206
|
+
);
|
|
207
|
+
expect(discoverComponents(core)).toEqual({Stack: ['Stack']});
|
|
208
|
+
});
|
|
209
|
+
|
|
124
210
|
it('returns {} for an empty src/ dir', () => {
|
|
125
211
|
const core = mkTmp('as-cd-emptysrc-');
|
|
126
212
|
fs.mkdirSync(path.join(core, 'src'));
|
|
@@ -133,6 +219,16 @@ describe('discoverComponents (real core)', () => {
|
|
|
133
219
|
});
|
|
134
220
|
});
|
|
135
221
|
|
|
222
|
+
describe('familyMember', () => {
|
|
223
|
+
it("returns a family doc's entry for a member, and null for a component's own doc", () => {
|
|
224
|
+
const stack = {name: 'Stack', components: [{name: 'Stack'}, {name: 'VStack', description: 'v'}]};
|
|
225
|
+
expect(familyMember(stack, 'VStack')).toEqual({name: 'VStack', description: 'v'});
|
|
226
|
+
expect(familyMember(stack, 'Stack')).toBeNull();
|
|
227
|
+
expect(familyMember({name: 'Button'}, 'Button')).toBeNull();
|
|
228
|
+
expect(familyMember(stack, 'HStack')).toBeNull();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
136
232
|
describe('findComponentReadme / findComponentSource / resolveImportPath', () => {
|
|
137
233
|
it('finds the doc + source for a top-level component', () => {
|
|
138
234
|
expect(findComponentReadme(CORE, 'Button')).toMatch(/Button\.doc\.mjs$/);
|
|
@@ -161,6 +161,24 @@ export async function resolveComponentReplacements(
|
|
|
161
161
|
typeof name === 'string' ? byTarget.get(name) : undefined,
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
+
// A first read under file names alone settles the common case, no
|
|
165
|
+
// declaration anywhere, without reading the names docs document.
|
|
166
|
+
let declares = false;
|
|
167
|
+
for (const integration of loadedIntegrations) {
|
|
168
|
+
if (declares || !integration?.components || integration.__loadError)
|
|
169
|
+
continue;
|
|
170
|
+
try {
|
|
171
|
+
const {components} = await discoverValidIntegrationComponents(
|
|
172
|
+
integration,
|
|
173
|
+
{documentedNames: false},
|
|
174
|
+
);
|
|
175
|
+
declares = components.some(record => record.replaces !== undefined);
|
|
176
|
+
} catch {
|
|
177
|
+
// Read again below, where a root that cannot be read is skipped.
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!declares) return result;
|
|
181
|
+
|
|
164
182
|
/** @type {Declaration[]} */
|
|
165
183
|
const declarations = [];
|
|
166
184
|
/** @type {Array<{name: string, package: string}>} */
|
|
@@ -259,6 +259,46 @@ describe('resolveComponentReplacements', () => {
|
|
|
259
259
|
]);
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
+
it('applies a replacement under the export a doc names when its file is named otherwise', async () => {
|
|
263
|
+
// Nav.doc.mjs documents AcmeSideNav, the export of a Nav.tsx that exports
|
|
264
|
+
// nothing named Nav.
|
|
265
|
+
const acme = integrationWithDocSource(
|
|
266
|
+
'@acme/nav',
|
|
267
|
+
'Nav',
|
|
268
|
+
BASE_DOC.replace("name: 'AcmeNav'", "name: 'AcmeSideNav'"),
|
|
269
|
+
);
|
|
270
|
+
fs.writeFileSync(
|
|
271
|
+
path.join(acme.components, 'Nav.tsx'),
|
|
272
|
+
'export function AcmeSideNav() { return null; }\n',
|
|
273
|
+
);
|
|
274
|
+
const result = await resolveComponentReplacements(CORE_DIR, [acme]);
|
|
275
|
+
expect(result.findings).toEqual([]);
|
|
276
|
+
expect(result.forTarget('SideNav')).toMatchObject({
|
|
277
|
+
name: 'AcmeSideNav',
|
|
278
|
+
package: '@acme/nav',
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("counts a doc's replaces once when the doc lists its own name as a member", async () => {
|
|
283
|
+
// Chip.doc.mjs documents AcmeChip beside a Chip.tsx that exports both, and
|
|
284
|
+
// lists itself first, as the component-family guide asks.
|
|
285
|
+
const acme = integrationWithDocSource(
|
|
286
|
+
'@acme/chips',
|
|
287
|
+
'Chip',
|
|
288
|
+
`export default {type: 'component', name: 'AcmeChip', replaces: 'Badge', usage: {description: 'Acme chip.'}, components: [{name: 'AcmeChip', description: 'A chip.', props: []}]};\n`,
|
|
289
|
+
);
|
|
290
|
+
fs.writeFileSync(
|
|
291
|
+
path.join(acme.components, 'Chip.tsx'),
|
|
292
|
+
'export function Chip() { return null; }\nexport function AcmeChip() { return null; }\n',
|
|
293
|
+
);
|
|
294
|
+
const result = await resolveComponentReplacements(CORE_DIR, [acme]);
|
|
295
|
+
expect(result.findings).toEqual([]);
|
|
296
|
+
expect(result.forTarget('Badge')).toMatchObject({
|
|
297
|
+
name: 'Chip',
|
|
298
|
+
package: '@acme/chips',
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
262
302
|
it('lets a replacement keep the Core name it replaces', async () => {
|
|
263
303
|
const acme = integration(
|
|
264
304
|
'@acme/nav',
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from 'node:fs';
|
|
8
8
|
import * as path from 'node:path';
|
|
9
|
+
import {listDir, listDirEntries, pathExists} from '../fs/listing-cache.mjs';
|
|
9
10
|
import {existsCaseExact} from '../fs/paths.mjs';
|
|
10
11
|
import {levenshteinDistance} from '../text/string-utils.mjs';
|
|
11
12
|
|
|
@@ -57,8 +58,8 @@ export function discoverHooks(coreDir) {
|
|
|
57
58
|
const hookCategories = new Map();
|
|
58
59
|
|
|
59
60
|
// 1. Scan src/hooks/ for *.doc.mjs files
|
|
60
|
-
if (
|
|
61
|
-
const entries =
|
|
61
|
+
if (pathExists(hooksDir)) {
|
|
62
|
+
const entries = listDirEntries(hooksDir);
|
|
62
63
|
for (const entry of entries) {
|
|
63
64
|
if (!entry.isFile()) continue;
|
|
64
65
|
if (!entry.name.endsWith('.doc.mjs')) continue;
|
|
@@ -70,8 +71,8 @@ export function discoverHooks(coreDir) {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
// 2. Scan ALL component directories for files matching use*.doc.mjs
|
|
73
|
-
if (
|
|
74
|
-
const topEntries =
|
|
74
|
+
if (pathExists(srcDir)) {
|
|
75
|
+
const topEntries = listDirEntries(srcDir);
|
|
75
76
|
for (const entry of topEntries) {
|
|
76
77
|
if (!entry.isDirectory() || SKIP_DIRS.has(entry.name) || entry.name === 'hooks') continue;
|
|
77
78
|
const dirPath = path.join(srcDir, entry.name);
|
|
@@ -114,8 +115,8 @@ export function discoverHooks(coreDir) {
|
|
|
114
115
|
* @param {Map<string, string>} hookCategories
|
|
115
116
|
*/
|
|
116
117
|
function scanDirForHookDocs(dirPath, hookCategories) {
|
|
117
|
-
if (!
|
|
118
|
-
const entries =
|
|
118
|
+
if (!pathExists(dirPath)) return;
|
|
119
|
+
const entries = listDirEntries(dirPath);
|
|
119
120
|
for (const entry of entries) {
|
|
120
121
|
if (entry.isDirectory() && !SKIP_DIRS.has(entry.name)) {
|
|
121
122
|
scanDirForHookDocs(path.join(dirPath, entry.name), hookCategories);
|
|
@@ -162,8 +163,8 @@ export function findHookDoc(coreDir, name) {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
// 2. Case-insensitive search in hooks directory
|
|
165
|
-
if (
|
|
166
|
-
const entries =
|
|
166
|
+
if (pathExists(hooksDir)) {
|
|
167
|
+
const entries = listDir(hooksDir);
|
|
167
168
|
for (const entry of entries) {
|
|
168
169
|
if (!entry.endsWith('.doc.mjs')) continue;
|
|
169
170
|
const hookName = hookNameFromFile(entry);
|
|
@@ -175,8 +176,8 @@ export function findHookDoc(coreDir, name) {
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
// 3. Check all component dirs for {name}.doc.mjs or use{Name}.doc.mjs
|
|
178
|
-
if (
|
|
179
|
-
const topEntries =
|
|
179
|
+
if (pathExists(srcDir)) {
|
|
180
|
+
const topEntries = listDirEntries(srcDir);
|
|
180
181
|
for (const entry of topEntries) {
|
|
181
182
|
if (!entry.isDirectory() || SKIP_DIRS.has(entry.name) || entry.name === 'hooks') continue;
|
|
182
183
|
const found = searchDirForHookDoc(path.join(srcDir, entry.name), uniqueCandidates);
|
|
@@ -213,8 +214,8 @@ export function findHookDoc(coreDir, name) {
|
|
|
213
214
|
* @returns {string | null}
|
|
214
215
|
*/
|
|
215
216
|
function searchDirForHookDoc(dirPath, candidates) {
|
|
216
|
-
if (!
|
|
217
|
-
const entries =
|
|
217
|
+
if (!pathExists(dirPath)) return null;
|
|
218
|
+
const entries = listDirEntries(dirPath);
|
|
218
219
|
for (const entry of entries) {
|
|
219
220
|
if (entry.isDirectory() && !SKIP_DIRS.has(entry.name)) {
|
|
220
221
|
const found = searchDirForHookDoc(path.join(dirPath, entry.name), candidates);
|
|
@@ -6,5 +6,32 @@
|
|
|
6
6
|
* @param {string} file
|
|
7
7
|
* @param {string} exportName
|
|
8
8
|
* @param {Set<string>} [seen]
|
|
9
|
+
* @returns {boolean}
|
|
9
10
|
*/
|
|
10
11
|
export function moduleExportsName(file: string, exportName: string, seen?: Set<string>): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The file that declares a module's runtime export, without executing it (the
|
|
14
|
+
* module, or where a local re-export leads); null when it cannot be proved.
|
|
15
|
+
* @param {string} file
|
|
16
|
+
* @param {string} exportName
|
|
17
|
+
* @param {Set<string>} [seen]
|
|
18
|
+
* @returns {string | null}
|
|
19
|
+
*/
|
|
20
|
+
export function moduleExportSource(file: string, exportName: string, seen?: Set<string>): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* The object a module exports, as plain data, read without running it: the
|
|
23
|
+
* first of `exportNames` it exports, an object literal in place or a top-level
|
|
24
|
+
* binding (under `satisfies` or `as` too). Only literal values are kept;
|
|
25
|
+
* anything computed, or overridable by a later spread, is left out.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} file
|
|
28
|
+
* @param {readonly string[]} exportNames `default` or named exports, in order
|
|
29
|
+
* @returns {Record<string, unknown> | null}
|
|
30
|
+
*/
|
|
31
|
+
export function staticExportObject(file: string, exportNames: readonly string[]): Record<string, unknown> | null;
|
|
32
|
+
/**
|
|
33
|
+
* Marks an object {@link staticExportObject} returns (or one inside it) whose
|
|
34
|
+
* source also has properties or spreads it could not read as literals. Not
|
|
35
|
+
* enumerable, so the object compares and serializes as its literal properties.
|
|
36
|
+
*/
|
|
37
|
+
export const HAS_COMPUTED: unique symbol;
|