@astryxdesign/cli 0.6.3-canary.db4e378 → 0.6.3-canary.db7b338
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/README.md +22 -1
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +1 -0
- package/api/component/component.doc.mjs +1 -0
- package/api/discover/discover.doc.mjs +1 -0
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +13 -105
- package/api/docs/detail/section/section.mjs +9 -15
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.doc.mjs +1 -0
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +25 -3
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +186 -14
- package/api/doctor/doctor.test.mjs +332 -7
- package/api/gap-report/gap-report.doc.mjs +1 -0
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/init/init.doc.mjs +1 -0
- package/api/integration/add-contribution.mjs +7 -7
- package/api/integration/add-contribution.test.mjs +37 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +1 -0
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +1 -0
- package/api/integration/integrationAddDoc.doc.mjs +1 -0
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.test.mjs +17 -47
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +50 -102
- package/api/integration/validate-integration.test.mjs +85 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +1 -0
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -0
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search.doc.mjs +1 -0
- package/api/search/search.mjs +16 -6
- package/api/swizzle/swizzle.doc.mjs +1 -0
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +1 -0
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +10 -17
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +1 -0
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +1 -0
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +97 -69
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/upgrade.doc.mjs +6 -1
- package/api/upgrade/upgrade.type.d.mts +34 -0
- package/api/upgrade/upgrade.type.mjs +15 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/docs/cli-integrations.doc.mjs +30 -30
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/doctypes/_schema.d.mts +71 -141
- package/authoring/doctypes/_schema.mjs +29 -2
- package/authoring/doctypes/base/graph-fields.doc.mjs +1 -1
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +1 -1
- package/authoring/doctypes/function/type.ts +1 -1
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +3 -2
- package/authoring/doctypes/namespace/namespace.doc.mjs +2 -2
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +10 -5
- package/authoring/doctypes/reference/reference.doc.mjs +6 -4
- package/authoring/doctypes/reference/type.ts +9 -10
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +7 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/type.ts +3 -9
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +10 -44
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +15 -58
- package/clients/cli/commands/docs.test.mjs +11 -14
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.test.mjs +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.controls.test.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +1 -1
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -1
- package/clients/cli/commands/layout-expand.doc.mjs +1 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +1 -1
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/text-json-parity.test.mjs +718 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/clients/cli/lib/hook-format.mjs +14 -5
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +50 -21
- package/foundation/config/project.test.mjs +3 -16
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-self-docs.test.mjs +3 -2
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +3 -2
- package/foundation/discovery/docs-discovery.mjs +14 -17
- package/foundation/discovery/docs-discovery.test.mjs +15 -15
- package/foundation/discovery/docs-section-key.d.mts +19 -8
- package/foundation/discovery/docs-section-key.mjs +119 -32
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +7 -0
- package/foundation/discovery/template-adapter.mjs +27 -40
- package/foundation/discovery/template-adapter.test.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +200 -0
- package/foundation/doc-compiler/compile.mjs +259 -9
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +286 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +189 -12
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +126 -0
- package/foundation/doc-compiler/read.mjs +320 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -57
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.mjs +104 -10
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +12 -2
- package/foundation/response/error-codes.mjs +7 -1
- package/foundation/response/error-codes.test.mjs +55 -11
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/package.json +10 -9
- package/assets/templates/themes/manifest.json +0 -95
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
* async). It does what loadConfig did — find the config sibling-of
|
|
16
16
|
* package.json, import + validate it, load the configured integrations —
|
|
17
17
|
* plus autolink the installed ones no config names, and self-resolve the
|
|
18
|
-
* package being authored when it carries a manifest.
|
|
18
|
+
* package being authored when it carries a manifest. Provider identity is
|
|
19
|
+
* resolved once over all three (see integrations/provider-resolution), and
|
|
20
|
+
* the ledger is kept for {@link providerLedgerOf}. Discovery is LAZY.
|
|
19
21
|
* - Discovery methods (components/templates/codemods/docs/themes) are MEMOIZED per
|
|
20
22
|
* instance (via the pluggable cache) and orchestrate the EXISTING discovery
|
|
21
23
|
* functions — Project never reimplements discovery.
|
|
@@ -38,10 +40,10 @@ import {parseConfig} from '../../authoring/config/parse.mjs';
|
|
|
38
40
|
import {
|
|
39
41
|
loadIntegrations,
|
|
40
42
|
loadLocalIntegration,
|
|
41
|
-
markProviderConflicts,
|
|
42
43
|
resolvePackageDir,
|
|
43
44
|
} from '../integrations/integrations.mjs';
|
|
44
|
-
import {
|
|
45
|
+
import {loadAutolinkCandidates} from '../integrations/autolink.mjs';
|
|
46
|
+
import {resolveProviders} from '../integrations/provider-resolution.mjs';
|
|
45
47
|
import {
|
|
46
48
|
setProject as setDebugProject,
|
|
47
49
|
setEventHandler as setDebugEventHandler,
|
|
@@ -297,6 +299,24 @@ export function findConfigPath(startDir = process.cwd()) {
|
|
|
297
299
|
return present.length === 1 ? present[0] : null;
|
|
298
300
|
}
|
|
299
301
|
|
|
302
|
+
/**
|
|
303
|
+
* The provider ledger each loaded Project resolved, kept off the class so it
|
|
304
|
+
* is not part of the Project API.
|
|
305
|
+
* @type {WeakMap<Project, import('../integrations/provider-resolution.mjs').ProviderLedger>}
|
|
306
|
+
*/
|
|
307
|
+
const PROVIDER_LEDGERS = new WeakMap();
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The provider ledger a Project resolved at load: one outcome for every
|
|
311
|
+
* package directory configured, autolinked, or authored. Internal: upgrade
|
|
312
|
+
* resolves on top of it, and tests account for every candidate with it.
|
|
313
|
+
* @param {Project} project
|
|
314
|
+
* @returns {import('../integrations/provider-resolution.mjs').ProviderLedger}
|
|
315
|
+
*/
|
|
316
|
+
export function providerLedgerOf(project) {
|
|
317
|
+
return PROVIDER_LEDGERS.get(project) ?? new Map();
|
|
318
|
+
}
|
|
319
|
+
|
|
300
320
|
/**
|
|
301
321
|
* The single API for reading resolved project configuration. Construct via the
|
|
302
322
|
* async {@link Project.load} factory.
|
|
@@ -402,17 +422,14 @@ export class Project {
|
|
|
402
422
|
// This runs whether or not a config exists, because the projects it reaches
|
|
403
423
|
// are overwhelmingly the ones with no astryx.config at all: a scaffold adds
|
|
404
424
|
// the dependency and writes no config, and the integration then contributes
|
|
405
|
-
// nothing for want of a line nobody knew to write.
|
|
425
|
+
// nothing for want of a line nobody knew to write. Resolved AFTER the
|
|
406
426
|
// configured ones so an explicit entry keeps its position and its
|
|
407
427
|
// precedence in every discovery order.
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
fresh,
|
|
414
|
-
})),
|
|
415
|
-
];
|
|
428
|
+
const autolinked = await loadAutolinkCandidates({
|
|
429
|
+
projectDir,
|
|
430
|
+
loaded: loadedIntegrations,
|
|
431
|
+
fresh,
|
|
432
|
+
});
|
|
416
433
|
|
|
417
434
|
// The package being authored is the one package that cannot install itself.
|
|
418
435
|
// When it carries a manifest, resolve its working bytes directly so every
|
|
@@ -420,17 +437,27 @@ export class Project {
|
|
|
420
437
|
// replaces the same installed package in place, preserving configured
|
|
421
438
|
// precedence while making the source being edited authoritative.
|
|
422
439
|
const localIntegration = await loadLocalIntegrationSafely(projectDir, fresh);
|
|
423
|
-
if (localIntegration) {
|
|
424
|
-
const existing = loadedIntegrations.findIndex(
|
|
425
|
-
integration => integration.name === localIntegration.name,
|
|
426
|
-
);
|
|
427
|
-
if (existing === -1) loadedIntegrations.push(localIntegration);
|
|
428
|
-
else loadedIntegrations[existing] = localIntegration;
|
|
429
|
-
}
|
|
430
440
|
|
|
431
441
|
// Autolinked and local packages can claim a provider ID that a configured
|
|
432
442
|
// package already holds, so identity is resolved once over the final set.
|
|
433
|
-
|
|
443
|
+
const resolution = resolveProviders([
|
|
444
|
+
...loadedIntegrations.map(integration => ({
|
|
445
|
+
source: /** @type {const} */ ('configured'),
|
|
446
|
+
integration,
|
|
447
|
+
spec: integration.__spec,
|
|
448
|
+
})),
|
|
449
|
+
...autolinked,
|
|
450
|
+
...(localIntegration
|
|
451
|
+
? [
|
|
452
|
+
{
|
|
453
|
+
source: /** @type {const} */ ('local'),
|
|
454
|
+
integration: localIntegration,
|
|
455
|
+
spec: localIntegration.__spec,
|
|
456
|
+
},
|
|
457
|
+
]
|
|
458
|
+
: []),
|
|
459
|
+
]);
|
|
460
|
+
loadedIntegrations = resolution.integrations;
|
|
434
461
|
|
|
435
462
|
// The debug recorder resolves its settings synchronously, long before any
|
|
436
463
|
// command gets here, so this is where a project's `debug` block gets a
|
|
@@ -461,7 +488,7 @@ export class Project {
|
|
|
461
488
|
// Never let recording break config loading.
|
|
462
489
|
}
|
|
463
490
|
|
|
464
|
-
|
|
491
|
+
const project = new Project({
|
|
465
492
|
cwd,
|
|
466
493
|
configPath,
|
|
467
494
|
config,
|
|
@@ -470,6 +497,8 @@ export class Project {
|
|
|
470
497
|
cache: resolvedCache,
|
|
471
498
|
hash,
|
|
472
499
|
});
|
|
500
|
+
PROVIDER_LEDGERS.set(project, resolution.ledger);
|
|
501
|
+
return project;
|
|
473
502
|
}
|
|
474
503
|
|
|
475
504
|
/**
|
|
@@ -163,7 +163,7 @@ function scaffoldLocalPackage({name = '@acme/local'} = {}) {
|
|
|
163
163
|
|
|
164
164
|
fs.mkdirSync(path.join(tmpDir, 'templates'));
|
|
165
165
|
fs.writeFileSync(
|
|
166
|
-
path.join(tmpDir, 'templates', 'local-page.
|
|
166
|
+
path.join(tmpDir, 'templates', 'local-page.doc.mjs'),
|
|
167
167
|
`export default {type: 'page', name: 'Local page', description: 'Local page.'};\n`,
|
|
168
168
|
);
|
|
169
169
|
fs.writeFileSync(
|
|
@@ -181,21 +181,8 @@ function scaffoldLocalPackage({name = '@acme/local'} = {}) {
|
|
|
181
181
|
|
|
182
182
|
fs.mkdirSync(path.join(tmpDir, 'themes', 'ocean'), {recursive: true});
|
|
183
183
|
fs.writeFileSync(
|
|
184
|
-
path.join(tmpDir, 'themes', '
|
|
185
|
-
|
|
186
|
-
version: 1,
|
|
187
|
-
themes: [
|
|
188
|
-
{
|
|
189
|
-
slug: 'ocean',
|
|
190
|
-
displayName: 'Ocean',
|
|
191
|
-
description: 'Ocean theme.',
|
|
192
|
-
maintained: true,
|
|
193
|
-
entry: 'oceanTheme.ts',
|
|
194
|
-
exportName: 'oceanTheme',
|
|
195
|
-
files: ['oceanTheme.ts'],
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
}),
|
|
184
|
+
path.join(tmpDir, 'themes', 'ocean', 'oceanTheme.doc.mjs'),
|
|
185
|
+
`/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */\nexport default {type: 'theme', name: 'ocean', displayName: 'Ocean', description: 'Ocean theme.', maintained: true};\n`,
|
|
199
186
|
);
|
|
200
187
|
fs.writeFileSync(
|
|
201
188
|
path.join(tmpDir, 'themes', 'ocean', 'oceanTheme.ts'),
|
|
@@ -24,6 +24,12 @@ export function loadAuthoringSelfDocs(sources?: string[], root?: string): Promis
|
|
|
24
24
|
error: string;
|
|
25
25
|
}[];
|
|
26
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* One self-doc as a topic section, keyed by the doc's own name.
|
|
29
|
+
* @param {any} doc
|
|
30
|
+
* @returns {import('../../authoring/doctypes/reference/type').ReferenceSection}
|
|
31
|
+
*/
|
|
32
|
+
export function selfDocSection(doc: any): import("../../authoring/doctypes/reference/type").ReferenceSection;
|
|
27
33
|
/**
|
|
28
34
|
* The `authoring` topic: one section per self-doc, in the order given.
|
|
29
35
|
* @param {any[]} docs
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
import * as fs from 'node:fs';
|
|
19
19
|
import * as path from 'node:path';
|
|
20
|
-
import {pathToFileURL} from 'node:url';
|
|
21
20
|
import {CLI_ROOT} from '../fs/paths.mjs';
|
|
21
|
+
import {readDocView} from '../doc-compiler/read.mjs';
|
|
22
22
|
import {
|
|
23
23
|
DOC_OUTPUT_BUDGET_BYTES,
|
|
24
24
|
oversizedDocSections,
|
|
@@ -31,6 +31,8 @@ export const AUTHORING_ROOT = path.join(CLI_ROOT, 'authoring');
|
|
|
31
31
|
export const AUTHORING_SELF_DOCS = [
|
|
32
32
|
'integration/integration.doc.mjs',
|
|
33
33
|
'config/config.doc.mjs',
|
|
34
|
+
'debug/debug.doc.mjs',
|
|
35
|
+
'gap-report/gap-report.doc.mjs',
|
|
34
36
|
'codemod/codemod.doc.mjs',
|
|
35
37
|
'identity/identity.doc.mjs',
|
|
36
38
|
'doctypes/base/graph-fields.doc.mjs',
|
|
@@ -43,6 +45,7 @@ export const AUTHORING_SELF_DOCS = [
|
|
|
43
45
|
'doctypes/reference/reference.doc.mjs',
|
|
44
46
|
'doctypes/schema/schema.doc.mjs',
|
|
45
47
|
'doctypes/template/template.doc.mjs',
|
|
48
|
+
'doctypes/theme/theme.doc.mjs',
|
|
46
49
|
];
|
|
47
50
|
|
|
48
51
|
/** Blocks a self-doc note may carry that a topic section can render. */
|
|
@@ -59,7 +62,8 @@ export function discoverAuthoringSelfDocSources(root = AUTHORING_ROOT) {
|
|
|
59
62
|
/** @param {string} dir */
|
|
60
63
|
const walk = dir => {
|
|
61
64
|
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
|
|
62
|
-
if (entry.name === 'node_modules' || entry.name.startsWith('__'))
|
|
65
|
+
if (entry.name === 'node_modules' || entry.name.startsWith('__'))
|
|
66
|
+
continue;
|
|
63
67
|
const full = path.join(dir, entry.name);
|
|
64
68
|
if (entry.isDirectory()) walk(full);
|
|
65
69
|
else if (entry.name.endsWith('.doc.mjs')) {
|
|
@@ -86,9 +90,14 @@ export async function loadAuthoringSelfDocs(
|
|
|
86
90
|
const failed = [];
|
|
87
91
|
for (const source of sources) {
|
|
88
92
|
try {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
const doc = await readDocView(path.join(root, source), {
|
|
94
|
+
root: 'self-docs',
|
|
95
|
+
loader: 'native',
|
|
96
|
+
});
|
|
97
|
+
if (
|
|
98
|
+
typeof doc?.name !== 'string' ||
|
|
99
|
+
typeof doc?.description !== 'string'
|
|
100
|
+
) {
|
|
92
101
|
throw new Error('exports no doc with a name and a description');
|
|
93
102
|
}
|
|
94
103
|
loaded.push({source, doc});
|
|
@@ -129,7 +138,7 @@ function fieldRows(fields) {
|
|
|
129
138
|
* @param {any} doc
|
|
130
139
|
* @returns {import('../../authoring/doctypes/reference/type').ReferenceSection}
|
|
131
140
|
*/
|
|
132
|
-
function selfDocSection(doc) {
|
|
141
|
+
export function selfDocSection(doc) {
|
|
133
142
|
/** @type {any[]} */
|
|
134
143
|
const content = [{type: 'prose', text: doc.description}];
|
|
135
144
|
if (doc.appliesTo) {
|
|
@@ -144,7 +153,8 @@ function selfDocSection(doc) {
|
|
|
144
153
|
});
|
|
145
154
|
}
|
|
146
155
|
for (const example of doc.examples ?? []) {
|
|
147
|
-
if (typeof example?.code !== 'string' || example.code.trim() === '')
|
|
156
|
+
if (typeof example?.code !== 'string' || example.code.trim() === '')
|
|
157
|
+
continue;
|
|
148
158
|
content.push({
|
|
149
159
|
type: 'code',
|
|
150
160
|
lang: example.lang ?? 'js',
|
|
@@ -74,14 +74,15 @@ describe('what the authoring docs say about the unbuilt docs graph', () => {
|
|
|
74
74
|
expect(graphFieldsDoc.description).toMatch(/not built yet/);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
it('
|
|
77
|
+
it('keeps graph blocks behind the separate GraphContentBlock type', () => {
|
|
78
78
|
const content = referenceDoc.fields
|
|
79
79
|
.flatMap(field => [field, ...(field.fields ?? [])])
|
|
80
80
|
.find(field => field.name === 'sections[].content');
|
|
81
|
+
expect(content.type).toBe('ReferenceContentBlock[]');
|
|
82
|
+
expect(content.description).toContain('GraphContentBlock');
|
|
81
83
|
for (const type of GRAPH_BLOCK_TYPES) {
|
|
82
84
|
expect(content.description).toContain(type);
|
|
83
85
|
}
|
|
84
|
-
expect(content.description).toMatch(/fails to load/);
|
|
85
86
|
});
|
|
86
87
|
|
|
87
88
|
it('says namespace docs are not loaded yet', () => {
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Every type `@astryxdesign/cli/authoring` exports, in the order index.d.ts
|
|
6
|
+
* lists them, each traced to the module that declares it. A value export that
|
|
7
|
+
* traces to a JavaScript module (a parser) is not a type and is left out;
|
|
8
|
+
* anything else that cannot be traced is reported, never dropped.
|
|
9
|
+
* @param {string} [root]
|
|
10
|
+
* @returns {{
|
|
11
|
+
* types: {name: string, module: string}[],
|
|
12
|
+
* untraced: {name: string, reason: string}[],
|
|
13
|
+
* }} `module` is relative to `root`
|
|
14
|
+
*/
|
|
15
|
+
export function tracePublicAuthoringTypes(root?: string): {
|
|
16
|
+
types: {
|
|
17
|
+
name: string;
|
|
18
|
+
module: string;
|
|
19
|
+
}[];
|
|
20
|
+
untraced: {
|
|
21
|
+
name: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* What stands between each type `@astryxdesign/cli/authoring` exports and a
|
|
27
|
+
* reader of `astryx docs authoring`. A type is readable when a self-doc beside
|
|
28
|
+
* the module that declares it is listed in AUTHORING_SELF_DOCS, loads, and
|
|
29
|
+
* renders a section the topic's index lists. A registered self-doc must
|
|
30
|
+
* document something public: a public type declared beside it, and, when its
|
|
31
|
+
* title is the name of a type declared beside it, that type.
|
|
32
|
+
* @param {{root?: string, sources?: string[], topicKeys?: Set<string> | null}} [options]
|
|
33
|
+
* `topicKeys` are the keys `astryx docs authoring --index` lists; null skips
|
|
34
|
+
* that comparison.
|
|
35
|
+
* @returns {Promise<{
|
|
36
|
+
* types: number,
|
|
37
|
+
* unreadable: {module: string, names: string[], reason: UnreadableReason, source?: string, key?: string}[],
|
|
38
|
+
* untraced: {name: string, reason: string}[],
|
|
39
|
+
* unmatched: {source: string, key?: string, subject?: string}[],
|
|
40
|
+
* }>}
|
|
41
|
+
*/
|
|
42
|
+
export function auditAuthoringSurface({ root, sources, topicKeys, }?: {
|
|
43
|
+
root?: string;
|
|
44
|
+
sources?: string[];
|
|
45
|
+
topicKeys?: Set<string> | null;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
types: number;
|
|
48
|
+
unreadable: {
|
|
49
|
+
module: string;
|
|
50
|
+
names: string[];
|
|
51
|
+
reason: UnreadableReason;
|
|
52
|
+
source?: string;
|
|
53
|
+
key?: string;
|
|
54
|
+
}[];
|
|
55
|
+
untraced: {
|
|
56
|
+
name: string;
|
|
57
|
+
reason: string;
|
|
58
|
+
}[];
|
|
59
|
+
unmatched: {
|
|
60
|
+
source: string;
|
|
61
|
+
key?: string;
|
|
62
|
+
subject?: string;
|
|
63
|
+
}[];
|
|
64
|
+
}>;
|
|
65
|
+
/** The barrel the `types` condition of `@astryxdesign/cli/authoring` names. */
|
|
66
|
+
export const AUTHORING_SURFACE: "index.d.ts";
|
|
67
|
+
export type Tracer = {
|
|
68
|
+
root: string;
|
|
69
|
+
/**
|
|
70
|
+
* top-level statements by absolute path
|
|
71
|
+
*/
|
|
72
|
+
parsed: Map<string, any[]>;
|
|
73
|
+
};
|
|
74
|
+
export type UnreadableReason = "no-self-doc" | "unregistered" | "failed" | "missing-section";
|