@astryxdesign/cli 0.7.10 → 0.7.11-canary.3df65bf
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/api/build/blocks/blocks.weights.json +1 -1
- package/api/build/build.doc.mjs +1 -1
- package/api/build/kit/rank.mjs +21 -4
- package/api/build/kit/signals.mjs +9 -3
- package/api/build/kit/start.d.mts +19 -0
- package/api/build/kit/start.mjs +49 -2
- package/api/build/kit/weights.d.mts +12 -0
- package/api/build/kit/weights.mjs +52 -16
- package/api/build/kit/words.d.mts +1 -0
- package/api/build/kit/words.mjs +1 -1
- package/api/docs/_adapter.mjs +2 -1
- package/api/doctor/_adapter.d.mts +28 -1
- package/api/doctor/_adapter.mjs +39 -2
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +9 -2
- package/api/doctor/theme-checks.d.mts +44 -3
- package/api/doctor/theme-checks.mjs +273 -6
- package/api/hook/hook.mjs +13 -0
- package/api/icon/_adapter.d.mts +3 -2
- package/api/icon/_adapter.mjs +8 -2
- package/api/icon/_authoring.d.mts +1 -0
- package/api/icon/_authoring.mjs +362 -38
- package/api/icon/_default-look.d.mts +155 -0
- package/api/icon/_default-look.mjs +474 -0
- package/api/icon/_records.d.mts +1 -1
- package/api/icon/_records.mjs +1 -0
- package/api/icon/add/add.mjs +224 -38
- package/api/icon/icon.type.d.mts +7 -2
- package/api/icon/icon.type.mjs +4 -2
- package/api/icon/iconAdd.doc.mjs +2 -2
- package/api/icon/iconNewDefinition.doc.mjs +3 -2
- package/api/icon/iconNewSet.doc.mjs +4 -4
- package/api/icon/search/search.mjs +10 -9
- package/api/integration/add-helpers.d.mts +2 -1
- package/api/integration/add-helpers.mjs +5 -2
- package/api/integration/authoring-checks.d.mts +0 -2
- package/api/integration/authoring-checks.mjs +1 -6
- package/api/integration/pack-check.d.mts +8 -6
- package/api/integration/pack-check.mjs +16 -6
- package/api/logger.mjs +2 -1
- package/api/render/_adapter.mjs +47 -1
- package/api/render/render.doc.mjs +2 -1
- package/api/search/_gather-components.mjs +2 -1
- package/api/swizzle/copy/copy.mjs +5 -1
- package/api/theme/build/build.mjs +15 -4
- package/assets/docs/author-a-theme.doc.mjs +2 -0
- package/assets/docs/getting-started.doc.mjs +20 -0
- package/assets/docs/tree/building-blocks.doc.mjs +1 -0
- package/assets/docs/tree/global-integrations.doc.mjs +1 -0
- package/assets/docs/tree/help.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +9 -3
- package/assets/docs/tree/quick-start.doc.mjs +1 -0
- package/assets/docs/tree/render-pages.doc.mjs +1 -1
- package/assets/docs/tree/ship.doc.mjs +1 -1
- package/assets/docs/tree/tokens-color.doc.mjs +2 -2
- package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.doc.mjs +15 -0
- package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.tsx +134 -0
- package/authoring/doctypes/_schema.d.mts +1 -1
- package/clients/cli/commands/build.doc.mjs +3 -2
- package/clients/cli/commands/build.mjs +34 -5
- package/clients/cli/commands/experimental/icon.mjs +31 -10
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
- package/clients/cli/index.mjs +36 -7
- package/foundation/discovery/authoring-self-docs.mjs +8 -3
- package/foundation/discovery/cli-self-docs.mjs +2 -1
- package/foundation/discovery/component-discovery.mjs +16 -0
- package/foundation/discovery/doc-types.mjs +9 -2
- package/foundation/discovery/docs-discovery.mjs +6 -4
- package/foundation/discovery/icon-definition-discovery.mjs +3 -3
- package/foundation/discovery/icon-ranking.d.mts +27 -3
- package/foundation/discovery/icon-ranking.mjs +125 -8
- package/foundation/discovery/icon-set-checks.mjs +40 -20
- package/foundation/discovery/icon-set-writer.d.mts +210 -16
- package/foundation/discovery/icon-set-writer.mjs +619 -79
- package/foundation/discovery/module-exports.d.mts +92 -4
- package/foundation/discovery/module-exports.mjs +410 -61
- package/foundation/discovery/template-adapter.mjs +5 -7
- package/foundation/discovery/theme-discovery.mjs +8 -10
- package/foundation/doc-compiler/tree.mjs +2 -2
- package/foundation/env/package-manager.d.mts +12 -4
- package/foundation/env/package-manager.mjs +15 -6
- package/foundation/env/semver.mjs +41 -9
- package/foundation/fs/listing-cache.d.mts +3 -1
- package/foundation/fs/listing-cache.mjs +63 -11
- package/foundation/fs/paths.mjs +2 -1
- package/foundation/release/notices.d.mts +16 -0
- package/foundation/release/notices.mjs +27 -6
- package/foundation/render/embedded-imports.d.mts +7 -0
- package/foundation/render/embedded-imports.mjs +1 -1
- package/foundation/render/page-worker.mjs +109 -4
- package/foundation/render/render-page.d.mts +16 -1
- package/foundation/render/render-page.mjs +25 -18
- package/foundation/render/served-packages.d.mts +33 -0
- package/foundation/render/served-packages.mjs +75 -0
- package/foundation/render/single-copy-hooks.d.mts +18 -0
- package/foundation/render/single-copy-hooks.mjs +44 -0
- package/foundation/text/shell-arg.d.mts +14 -0
- package/foundation/text/shell-arg.mjs +17 -0
- package/foundation/text/string-utils.mjs +25 -25
- package/package.json +6 -6
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
discoverDoctorThemes,
|
|
16
16
|
discoverDoctorUnmigratedCopies,
|
|
17
17
|
findDoctorCoreDir,
|
|
18
|
+
doctorElementPropOrigins,
|
|
19
|
+
doctorStylesheetImports,
|
|
18
20
|
findDoctorInstalledPackage,
|
|
21
|
+
realDoctorFile,
|
|
19
22
|
isLocalThemeOwner,
|
|
20
23
|
listDoctorThemePackages,
|
|
21
24
|
listProjectSourceFiles,
|
|
@@ -135,8 +138,12 @@ function walkAst(value, visit) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
/**
|
|
139
|
-
|
|
141
|
+
/**
|
|
142
|
+
* @param {string} source
|
|
143
|
+
* @param {{runtimeOnly?: boolean}} [options] - skip type-only imports and
|
|
144
|
+
* re-exports, which the build erases
|
|
145
|
+
*/
|
|
146
|
+
function moduleSpecifiers(source, options = {}) {
|
|
140
147
|
const values = new Set();
|
|
141
148
|
walkAst(parseModule(source), node => {
|
|
142
149
|
if (
|
|
@@ -145,7 +152,11 @@ function moduleSpecifiers(source) {
|
|
|
145
152
|
'ExportNamedDeclaration',
|
|
146
153
|
'ExportAllDeclaration',
|
|
147
154
|
].includes(node.type) &&
|
|
148
|
-
typeof node.source?.value === 'string'
|
|
155
|
+
typeof node.source?.value === 'string' &&
|
|
156
|
+
!(
|
|
157
|
+
options.runtimeOnly &&
|
|
158
|
+
(node.importKind === 'type' || node.exportKind === 'type')
|
|
159
|
+
)
|
|
149
160
|
) {
|
|
150
161
|
values.add(node.source.value);
|
|
151
162
|
}
|
|
@@ -406,18 +417,248 @@ function appPackageNamesTheme(cwd) {
|
|
|
406
417
|
return Boolean(pkg?.astryx?.theme);
|
|
407
418
|
}
|
|
408
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Whether one import specifier names a theme's built module or stylesheet.
|
|
422
|
+
* @param {string} specifier
|
|
423
|
+
* @param {string} file - the importing file
|
|
424
|
+
* @param {ResolvedAppTheme} theme
|
|
425
|
+
*/
|
|
426
|
+
function importsTheme(specifier, file, theme) {
|
|
427
|
+
if (theme.source === 'local') {
|
|
428
|
+
return (
|
|
429
|
+
specifierTargets(specifier, file, theme.moduleFile) ||
|
|
430
|
+
specifierTargets(specifier, file, theme.stylesheetFile)
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
return specifier === theme.module || specifier === theme.stylesheet;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const CORE_THEME_SOURCES = new Set([
|
|
437
|
+
'@astryxdesign/core',
|
|
438
|
+
'@astryxdesign/core/theme',
|
|
439
|
+
]);
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* The base a `defineTheme({extends: base})` call extends, for
|
|
443
|
+
* {@link doctorElementPropOrigins}: a theme made that way stands for its base.
|
|
444
|
+
* @param {any} init
|
|
445
|
+
* @returns {any}
|
|
446
|
+
*/
|
|
447
|
+
function definedThemeBase(init) {
|
|
448
|
+
if (
|
|
449
|
+
init?.type !== 'CallExpression' ||
|
|
450
|
+
init.callee?.type !== 'Identifier' ||
|
|
451
|
+
init.callee.name !== 'defineTheme'
|
|
452
|
+
) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
const options = init.arguments?.[0];
|
|
456
|
+
if (options?.type !== 'ObjectExpression') return null;
|
|
457
|
+
const base = options.properties.find(
|
|
458
|
+
(/** @type {any} */ property) =>
|
|
459
|
+
property.type === 'ObjectProperty' &&
|
|
460
|
+
!property.computed &&
|
|
461
|
+
(property.key?.name ?? property.key?.value) === 'extends',
|
|
462
|
+
);
|
|
463
|
+
return base?.value ?? null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* The themes the app wires itself, without a generated theme module or a
|
|
468
|
+
* package.json `astryx.theme`. A theme is wired when the app's own source
|
|
469
|
+
* imports its built module or stylesheet ({@link resolveDoctorThemeImports}
|
|
470
|
+
* names them: the imports `theme add` writes), or when the app passes it to
|
|
471
|
+
* Core's `Theme`: {@link doctorElementPropOrigins} follows the `theme` value through
|
|
472
|
+
* module-scope aliases, `defineTheme({extends})`, re-exports and installed
|
|
473
|
+
* packages to where it is declared, which must be inside an installed theme
|
|
474
|
+
* package or be a local theme's built module. Only themes the app can load
|
|
475
|
+
* count: a theme whose package is not installed is never wired. A `theme`
|
|
476
|
+
* value whose origin is anything else (a prop, a function result, a lookup)
|
|
477
|
+
* is reported as unconfirmed, never as missing. The scan reads app source only
|
|
478
|
+
* (no dependencies, build output, links or type-only imports) within the
|
|
479
|
+
* bounded source walk, and executes nothing.
|
|
480
|
+
* @param {string} cwd
|
|
481
|
+
* @returns {Promise<{
|
|
482
|
+
* wired: Array<{slug: string, owner: string, file: string}>,
|
|
483
|
+
* unconfirmed: Array<{file: string}>,
|
|
484
|
+
* }>}
|
|
485
|
+
*/
|
|
486
|
+
export async function themeImportWiring(cwd) {
|
|
487
|
+
const none = {wired: [], unconfirmed: []};
|
|
488
|
+
let state;
|
|
489
|
+
try {
|
|
490
|
+
state = readThemeState(cwd);
|
|
491
|
+
} catch {
|
|
492
|
+
return none;
|
|
493
|
+
}
|
|
494
|
+
// A generated module or `astryx.theme` already decides the result.
|
|
495
|
+
if (state.configured || appPackageNamesTheme(cwd)) return none;
|
|
496
|
+
const projectDir = state.projectDir;
|
|
497
|
+
/** @type {DiscoveredTheme[]} */
|
|
498
|
+
let available;
|
|
499
|
+
try {
|
|
500
|
+
available = await discoverDoctorThemes(projectDir);
|
|
501
|
+
} catch {
|
|
502
|
+
return none;
|
|
503
|
+
}
|
|
504
|
+
const ownerCounts = new Map();
|
|
505
|
+
for (const theme of available) {
|
|
506
|
+
const owner = themeRecordOwner(theme);
|
|
507
|
+
ownerCounts.set(owner, (ownerCounts.get(owner) ?? 0) + 1);
|
|
508
|
+
}
|
|
509
|
+
/** @type {Map<string, string | null>} */
|
|
510
|
+
const installedDirs = new Map();
|
|
511
|
+
const installedDir = (/** @type {string} */ owner) => {
|
|
512
|
+
if (!installedDirs.has(owner)) {
|
|
513
|
+
const dir = findDoctorInstalledPackage(projectDir, owner);
|
|
514
|
+
installedDirs.set(owner, dir ? realDoctorFile(dir) : null);
|
|
515
|
+
}
|
|
516
|
+
return installedDirs.get(owner) ?? null;
|
|
517
|
+
};
|
|
518
|
+
// Only themes the app can load: local themes, and package themes whose
|
|
519
|
+
// package is installed (discovery also lists the CLI's bundled themes).
|
|
520
|
+
/** @type {ResolvedAppTheme[]} */
|
|
521
|
+
const themes = [];
|
|
522
|
+
for (const theme of available) {
|
|
523
|
+
let resolved;
|
|
524
|
+
try {
|
|
525
|
+
resolved = resolveDoctorThemeImports(theme, {
|
|
526
|
+
cwd: projectDir,
|
|
527
|
+
ownerThemeCount: ownerCounts.get(themeRecordOwner(theme)) ?? 1,
|
|
528
|
+
});
|
|
529
|
+
} catch {
|
|
530
|
+
// A theme without built imports cannot be wired by importing them.
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (resolved.source === 'local' || installedDir(resolved.owner)) {
|
|
534
|
+
themes.push(resolved);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (themes.length === 0) return none;
|
|
538
|
+
/**
|
|
539
|
+
* The theme a `Theme` value's origin is, or null.
|
|
540
|
+
* @param {{file: string, name: string} | null} origin
|
|
541
|
+
*/
|
|
542
|
+
const themeAt = origin => {
|
|
543
|
+
const file = origin ? realDoctorFile(origin.file) : null;
|
|
544
|
+
if (!origin || !file) return null;
|
|
545
|
+
const local = themes.find(
|
|
546
|
+
theme =>
|
|
547
|
+
theme.source === 'local' && realDoctorFile(theme.moduleFile) === file,
|
|
548
|
+
);
|
|
549
|
+
if (local) return local;
|
|
550
|
+
const owned = themes.filter(theme => {
|
|
551
|
+
const dir = theme.source === 'local' ? null : installedDir(theme.owner);
|
|
552
|
+
return dir != null && file.startsWith(`${dir}${path.sep}`);
|
|
553
|
+
});
|
|
554
|
+
const named = owned.filter(theme => theme.exportName === origin.name);
|
|
555
|
+
if (named.length === 1) return named[0];
|
|
556
|
+
return owned.length === 1 ? owned[0] : null;
|
|
557
|
+
};
|
|
558
|
+
/** @type {Map<string, {slug: string, owner: string, file: string}>} */
|
|
559
|
+
const wired = new Map();
|
|
560
|
+
const keyOf = (/** @type {ResolvedAppTheme} */ theme) =>
|
|
561
|
+
`${theme.owner}\u0000${theme.slug}`;
|
|
562
|
+
/** @type {Set<string>} */
|
|
563
|
+
const unconfirmed = new Set();
|
|
564
|
+
for (const file of listProjectSourceFiles(projectDir, '', {
|
|
565
|
+
stylesheets: true,
|
|
566
|
+
})) {
|
|
567
|
+
let source;
|
|
568
|
+
try {
|
|
569
|
+
source = readTextFile(file);
|
|
570
|
+
} catch {
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
const shown = relative(projectDir, file);
|
|
574
|
+
const candidates = themes.filter(
|
|
575
|
+
theme =>
|
|
576
|
+
!wired.has(keyOf(theme)) &&
|
|
577
|
+
(theme.source === 'local'
|
|
578
|
+
? source.includes(path.basename(theme.moduleFile)) ||
|
|
579
|
+
source.includes(path.basename(theme.stylesheetFile))
|
|
580
|
+
: source.includes(theme.module) || source.includes(theme.stylesheet)),
|
|
581
|
+
);
|
|
582
|
+
if (candidates.length > 0) {
|
|
583
|
+
let specifiers;
|
|
584
|
+
try {
|
|
585
|
+
specifiers =
|
|
586
|
+
path.extname(file) === '.css'
|
|
587
|
+
? doctorStylesheetImports(source)
|
|
588
|
+
: moduleSpecifiers(source, {runtimeOnly: true});
|
|
589
|
+
} catch {
|
|
590
|
+
specifiers = new Set();
|
|
591
|
+
}
|
|
592
|
+
for (const theme of candidates) {
|
|
593
|
+
if ([...specifiers].some(spec => importsTheme(spec, file, theme))) {
|
|
594
|
+
wired.set(keyOf(theme), {
|
|
595
|
+
slug: theme.slug,
|
|
596
|
+
owner: theme.owner,
|
|
597
|
+
file: shown,
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if (path.extname(file) === '.css' || !source.includes('theme=')) continue;
|
|
603
|
+
for (const origin of doctorElementPropOrigins(file, {
|
|
604
|
+
sources: CORE_THEME_SOURCES,
|
|
605
|
+
name: 'Theme',
|
|
606
|
+
prop: 'theme',
|
|
607
|
+
unwrap: definedThemeBase,
|
|
608
|
+
})) {
|
|
609
|
+
const theme = themeAt(origin);
|
|
610
|
+
if (!theme) {
|
|
611
|
+
unconfirmed.add(shown);
|
|
612
|
+
} else if (!wired.has(keyOf(theme))) {
|
|
613
|
+
wired.set(keyOf(theme), {
|
|
614
|
+
slug: theme.slug,
|
|
615
|
+
owner: theme.owner,
|
|
616
|
+
file: shown,
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
// In discovery order, so the report does not depend on the file walk.
|
|
622
|
+
return {
|
|
623
|
+
wired: themes.flatMap(theme => {
|
|
624
|
+
const found = wired.get(keyOf(theme));
|
|
625
|
+
return found ? [found] : [];
|
|
626
|
+
}),
|
|
627
|
+
unconfirmed: [...unconfirmed].sort().map(file => ({file})),
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* The pass message's list of themes wired by import, each with the file that
|
|
633
|
+
* imports it.
|
|
634
|
+
* @param {Array<{slug: string, file: string}>} wired
|
|
635
|
+
*/
|
|
636
|
+
function wiredByImportList(wired) {
|
|
637
|
+
const shown = wired.slice(0, 5).map(({slug, file}) => `${slug} (${file})`);
|
|
638
|
+
const more = wired.length - shown.length;
|
|
639
|
+
return more > 0 ? `${shown.join(', ')} and ${more} more` : shown.join(', ');
|
|
640
|
+
}
|
|
641
|
+
|
|
409
642
|
/**
|
|
410
643
|
* The `themes` check that every released doctor report carries. Its id is
|
|
411
644
|
* stable, so it stays beside the app-theme checks. Without a generated theme
|
|
412
645
|
* module it reports what it always has: whether an `@astryxdesign/theme-*`
|
|
413
646
|
* package is installed, and whether the app's package.json names a theme in
|
|
414
|
-
* `astryx.theme
|
|
415
|
-
*
|
|
647
|
+
* `astryx.theme`, or else whether the app's own source imports a theme's built
|
|
648
|
+
* module or stylesheet ({@link themeImportWiring}). With a generated module it
|
|
649
|
+
* reports the overall result of the app-theme checks.
|
|
416
650
|
* @param {string} cwd
|
|
417
651
|
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
652
|
+
* @param {{wired: Array<{slug: string, file: string}>, unconfirmed: Array<{file: string}>}} [wiring] -
|
|
653
|
+
* what {@link themeImportWiring} returned
|
|
418
654
|
* @returns {DoctorCheck}
|
|
419
655
|
*/
|
|
420
|
-
export function checkThemes(
|
|
656
|
+
export function checkThemes(
|
|
657
|
+
cwd,
|
|
658
|
+
appChecks,
|
|
659
|
+
wiring = {wired: [], unconfirmed: []},
|
|
660
|
+
) {
|
|
661
|
+
const wiredByImport = wiring.wired;
|
|
421
662
|
const label = 'Theme packages';
|
|
422
663
|
const managed = appChecks.some(
|
|
423
664
|
check => APP_THEME_CHECK_IDS.has(check.id) && check.status !== 'info',
|
|
@@ -475,6 +716,14 @@ export function checkThemes(cwd, appChecks) {
|
|
|
475
716
|
|
|
476
717
|
const run = getCliInvocation(cwd);
|
|
477
718
|
const packages = listDoctorThemePackages(cwd);
|
|
719
|
+
if (packages.length === 0 && wiredByImport.length > 0) {
|
|
720
|
+
return {
|
|
721
|
+
id: 'themes',
|
|
722
|
+
label,
|
|
723
|
+
status: 'pass',
|
|
724
|
+
message: `Themes wired by import: ${wiredByImportList(wiredByImport)}.`,
|
|
725
|
+
};
|
|
726
|
+
}
|
|
478
727
|
if (packages.length === 0) {
|
|
479
728
|
return {
|
|
480
729
|
id: 'themes',
|
|
@@ -485,6 +734,24 @@ export function checkThemes(cwd, appChecks) {
|
|
|
485
734
|
};
|
|
486
735
|
}
|
|
487
736
|
const names = packages.join(', ');
|
|
737
|
+
if (!appPackageNamesTheme(cwd) && wiredByImport.length > 0) {
|
|
738
|
+
return {
|
|
739
|
+
id: 'themes',
|
|
740
|
+
label,
|
|
741
|
+
status: 'pass',
|
|
742
|
+
message: `Theme package(s) installed (${names}); wired by import: ${wiredByImportList(wiredByImport)}.`,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (!appPackageNamesTheme(cwd) && wiring.unconfirmed.length > 0) {
|
|
746
|
+
const files = wiring.unconfirmed.map(({file}) => file).join(', ');
|
|
747
|
+
return {
|
|
748
|
+
id: 'themes',
|
|
749
|
+
label,
|
|
750
|
+
status: 'info',
|
|
751
|
+
message: `Theme package(s) installed (${names}); ${files} pass${wiring.unconfirmed.length === 1 ? 'es' : ''} a theme to Theme that doctor could not trace to a theme import, so it could not confirm which theme is wired.`,
|
|
752
|
+
fix: `If no theme is applied, add one with \`${run} theme add <slug>\`.`,
|
|
753
|
+
};
|
|
754
|
+
}
|
|
488
755
|
if (!appPackageNamesTheme(cwd)) {
|
|
489
756
|
return {
|
|
490
757
|
id: 'themes',
|
package/api/hook/hook.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import {detail as detailLeaf} from './detail/detail.mjs';
|
|
|
19
19
|
import {params as paramsLeaf} from './detail/params/params.mjs';
|
|
20
20
|
import {AstryxError} from '../error.mjs';
|
|
21
21
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
22
|
+
import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @param {string} [name]
|
|
@@ -33,6 +34,18 @@ import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
|
33
34
|
* @returns {Promise<{type: string, data: unknown}>}
|
|
34
35
|
*/
|
|
35
36
|
export async function hook(name, options = {}) {
|
|
37
|
+
// Each hook's lookup walks the same source tree, so the call reads each
|
|
38
|
+
// directory once.
|
|
39
|
+
return withListingCache(() => hookRead(name, options));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* {@link hook}, without the call's listing cache.
|
|
44
|
+
* @param {string} [name]
|
|
45
|
+
* @param {Parameters<typeof hook>[1]} [options]
|
|
46
|
+
* @returns {ReturnType<typeof hook>}
|
|
47
|
+
*/
|
|
48
|
+
async function hookRead(name, options = {}) {
|
|
36
49
|
const {
|
|
37
50
|
cwd = process.cwd(),
|
|
38
51
|
list: listFlag = false,
|
package/api/icon/_adapter.d.mts
CHANGED
|
@@ -50,6 +50,7 @@ export { astryxIconDefinitions } from "../../foundation/discovery/icon-definitio
|
|
|
50
50
|
export { iconSetKey } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
51
51
|
export { setConfigString } from "../../foundation/config/config-writer.mjs";
|
|
52
52
|
export { exportValueKind } from "../../foundation/discovery/module-exports.mjs";
|
|
53
|
-
export { iconRecord, importLine, leadingReading, matchIcon, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
|
|
54
|
-
export { assertIconExport, checkNewDefinition, definitionFile, findLocalIconSet, writeDefinitionFile, iconIdOf, closestNames, libraryIcons, mappableDefinitions, resolveIconSource, generatedModulePath, generatedNamesOf, generatedOrigins, iconModulePackage, sameIconModule, iconExportName, iconNaming, modulePrefix, setModuleNote, variantExportName, writeGeneratedIcons, writeIconSetData, definitionNameOf, iconIdIn, iconsWithWord, localSourceNote, THEME_MAP_NAME } from "../../foundation/discovery/icon-set-writer.mjs";
|
|
53
|
+
export { iconRecord, importLine, leadingReading, matchIcon, answeringMatches, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
|
|
54
|
+
export { assertIconExport, checkNewDefinition, definitionNameFromInput, definitionFile, findLocalIconSet, writeDefinitionFile, iconIdOf, closestNames, libraryIcons, mappableDefinitions, resolveIconSource, generatedModulePath, generatedNamesOf, generatedOrigins, iconModulePackage, sameIconModule, iconExportName, iconNaming, modulePrefix, moduleNaming, iconNamingWithoutLook, splitLook, setModuleNote, variantExportName, writeGeneratedIcons, writeIconSetData, definitionNameOf, iconIdIn, iconsWithWord, localSourceNote, THEME_MAP_NAME } from "../../foundation/discovery/icon-set-writer.mjs";
|
|
55
55
|
export { addIconDefinition, addIconSet } from "./_authoring.mjs";
|
|
56
|
+
export { checkVariantLook, drawnLooks } from "./_default-look.mjs";
|
package/api/icon/_adapter.mjs
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @position api/icon — adapter for api/icon/{search,detail,list,use,map,add,
|
|
8
8
|
* new-set,new-definition}; it also carries the icon ranking, the icon-set
|
|
9
|
-
* writer, the set and definition authoring writes,
|
|
10
|
-
* the leaves use
|
|
9
|
+
* writer, the set and definition authoring writes, the default-look
|
|
10
|
+
* rule, and the config writer the leaves use
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import * as fs from 'node:fs';
|
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
importLine,
|
|
29
29
|
leadingReading,
|
|
30
30
|
matchIcon,
|
|
31
|
+
answeringMatches,
|
|
31
32
|
rankIcons,
|
|
32
33
|
scoreIcon,
|
|
33
34
|
} from '../../foundation/discovery/icon-ranking.mjs';
|
|
@@ -37,6 +38,7 @@ export {setConfigString} from '../../foundation/config/config-writer.mjs';
|
|
|
37
38
|
export {
|
|
38
39
|
assertIconExport,
|
|
39
40
|
checkNewDefinition,
|
|
41
|
+
definitionNameFromInput,
|
|
40
42
|
definitionFile,
|
|
41
43
|
findLocalIconSet,
|
|
42
44
|
writeDefinitionFile,
|
|
@@ -53,6 +55,9 @@ export {
|
|
|
53
55
|
iconExportName,
|
|
54
56
|
iconNaming,
|
|
55
57
|
modulePrefix,
|
|
58
|
+
moduleNaming,
|
|
59
|
+
iconNamingWithoutLook,
|
|
60
|
+
splitLook,
|
|
56
61
|
setModuleNote,
|
|
57
62
|
variantExportName,
|
|
58
63
|
writeGeneratedIcons,
|
|
@@ -65,6 +70,7 @@ export {
|
|
|
65
70
|
} from '../../foundation/discovery/icon-set-writer.mjs';
|
|
66
71
|
export {exportValueKind} from '../../foundation/discovery/module-exports.mjs';
|
|
67
72
|
export {addIconDefinition, addIconSet} from './_authoring.mjs';
|
|
73
|
+
export {checkVariantLook, drawnLooks} from './_default-look.mjs';
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
* Refuse a command that writes to a project or package when `cwd` is outside
|