@astryxdesign/cli 0.7.15 → 0.7.16-canary.g54dd64e
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 +5 -3
- package/api/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +17 -0
- package/api/doctor/_adapter.mjs +35 -0
- package/api/doctor/doctor.mjs +18 -4
- package/api/integration/pack-check.mjs +13 -7
- package/api/integration/validate-integration.mjs +1 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +43 -12
- package/api/theme/build/build.d.mts +64 -27
- package/api/theme/build/build.mjs +341 -69
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +102 -25
- package/api/theme/theme.type.d.mts +5 -1
- package/api/theme/theme.type.mjs +2 -1
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +9 -3
- package/api/theme-edit/_adapter.d.mts +33 -0
- package/api/theme-edit/_adapter.mjs +208 -31
- package/api/theme-edit/_check.d.mts +38 -0
- package/api/theme-edit/_check.mjs +1326 -211
- package/api/theme-edit/_color.d.mts +2 -8
- package/api/theme-edit/_color.mjs +292 -219
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +20 -1
- package/api/theme-edit/_context.d.mts +29 -0
- package/api/theme-edit/_context.mjs +329 -30
- package/api/theme-edit/_css.d.mts +60 -1
- package/api/theme-edit/_css.mjs +404 -28
- package/api/theme-edit/_edit.d.mts +9 -0
- package/api/theme-edit/_edit.mjs +1025 -126
- package/api/theme-edit/_how-commands.d.mts +11 -26
- package/api/theme-edit/_how-commands.mjs +30 -2
- package/api/theme-edit/_how-question.d.mts +7 -0
- package/api/theme-edit/_how-question.mjs +1304 -176
- package/api/theme-edit/_how.mjs +144 -30
- package/api/theme-edit/_overview.mjs +2 -0
- package/api/theme-edit/_palette.d.mts +11 -0
- package/api/theme-edit/_palette.mjs +194 -65
- package/api/theme-edit/_parts.d.mts +16 -0
- package/api/theme-edit/_parts.mjs +59 -7
- package/api/theme-edit/_png.mjs +19 -14
- package/api/theme-edit/_preview-app.d.mts +3 -0
- package/api/theme-edit/_preview-app.mjs +843 -45
- package/api/theme-edit/_preview.d.mts +16 -3
- package/api/theme-edit/_preview.mjs +310 -29
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +46 -12
- package/api/theme-edit/_settings.d.mts +178 -5
- package/api/theme-edit/_settings.mjs +2035 -86
- package/api/theme-edit/_tables.d.mts +24 -0
- package/api/theme-edit/_tables.mjs +211 -149
- package/api/theme-edit/_vet.d.mts +42 -0
- package/api/theme-edit/_vet.mjs +144 -0
- package/api/theme-edit/theme-edit.type.d.mts +2 -1
- package/api/theme-edit/theme-edit.type.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditShow.doc.mjs +11 -3
- package/api/upgrade/registry/registry.mjs +6 -1
- package/assets/docs/tree/single-component.doc.mjs +11 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -2
- package/assets/preview-app/next.config.mjs +7 -1
- package/assets/preview-app/package.json +1 -0
- package/assets/preview-app/src/app/globals.css +1 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/dashboard/page.tsx +1 -1
- package/authoring/doctypes/_schema.d.mts +52 -5
- package/authoring/doctypes/_schema.mjs +62 -7
- package/authoring/doctypes/base/type.ts +10 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/function/function.doc.mjs +6 -0
- package/authoring/doctypes/function/type.ts +3 -0
- package/authoring/doctypes/legacy.mjs +5 -1
- package/authoring/index.d.ts +1 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/experimental/theme.mjs +190 -37
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +3 -1
- package/clients/cli/commands/theme.mjs +168 -45
- package/clients/cli/formatters/index.mjs +7 -4
- package/clients/cli/lib/cli-error.mjs +9 -3
- package/clients/cli/lib/component-format.mjs +27 -9
- package/clients/cli/lib/json-shim.mjs +40 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +49 -0
- package/foundation/config/project.mjs +50 -14
- package/foundation/discovery/theme-discovery.d.mts +5 -1
- package/foundation/discovery/theme-discovery.mjs +24 -3
- package/foundation/fs/gather-cache.d.mts +9 -2
- package/foundation/fs/gather-cache.mjs +79 -15
- package/foundation/fs/paths.d.mts +31 -0
- package/foundation/fs/paths.mjs +43 -10
- package/foundation/render/host-exit.d.mts +8 -0
- package/foundation/render/host-exit.mjs +11 -0
- package/foundation/render/page-host.mjs +56 -10
- package/foundation/render/page-worker.mjs +14 -0
- package/foundation/render/render-page.mjs +37 -2
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +5 -0
- package/foundation/response/error-codes.mjs +3 -0
- package/foundation/response/json.d.mts +15 -0
- package/foundation/response/json.mjs +52 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -223,6 +223,7 @@ if (isError(result)) {
|
|
|
223
223
|
| `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
|
|
224
224
|
| `ERR_THEME_INVALID` | A theme definition or contributed theme descriptor is invalid. |
|
|
225
225
|
| `ERR_THEME_LOAD` | A theme file could not be loaded / parsed into a defineTheme result. |
|
|
226
|
+
| `ERR_THEME_STALE` | `theme build --check` found stale or missing outputs: exit 1, in the check result (`code`), not an error. |
|
|
226
227
|
| `ERR_PALETTE_GENERATION` | A palette generation request or one of its constraints was invalid. |
|
|
227
228
|
| `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
|
|
228
229
|
| `ERR_INVALID_VERSION` | A `--from`/`--to` value was not a valid semver string. |
|
|
@@ -511,7 +512,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
511
512
|
| `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
|
|
512
513
|
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
|
|
513
514
|
| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
|
|
514
|
-
| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}),
|
|
515
|
+
| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), the full list of checked paths, and, when any is stale or missing, code ERR_THEME_STALE. Writes nothing. |
|
|
515
516
|
| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
|
|
516
517
|
| `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
|
|
517
518
|
| `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
|
|
@@ -540,8 +541,9 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
540
541
|
|
|
541
542
|
## Doctor
|
|
542
543
|
|
|
543
|
-
`astryx doctor` runs
|
|
544
|
-
|
|
544
|
+
`astryx doctor` runs health checks against your project and environment. It
|
|
545
|
+
changes nothing in the project; once the per-user cache folder exists, it
|
|
546
|
+
keeps its docs checks and integration check results there. Each record uses `[ok]`, `[warn]`, `[fail]`, or `[info]`, and
|
|
545
547
|
includes an actionable `fix` when one is available. Field names match the
|
|
546
548
|
`--json` keys. The exact checks and values depend on the project; the output
|
|
547
549
|
shape is stable:
|
|
@@ -206,7 +206,7 @@ export function extractProps(docs: LoadedComponentDoc): any[];
|
|
|
206
206
|
* Augment a loaded `component.detail` doc with ownership metadata. Adds
|
|
207
207
|
* `package`, the resolved `import` specifier, and `sourceAvailable` (whether a
|
|
208
208
|
* swizzleable source file exists for the owner). Existing doc fields (name,
|
|
209
|
-
* usage, props, …) are preserved
|
|
209
|
+
* usage, props, …) are preserved; each example carries its `kind`.
|
|
210
210
|
* @param {LoadedComponentDoc} docs
|
|
211
211
|
* @param {OwnershipSubject} owner
|
|
212
212
|
* @param {string} componentName
|
|
@@ -589,11 +589,26 @@ export function extractProps(docs) {
|
|
|
589
589
|
);
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Give every example its `kind`, so a JSON reader never has to know the
|
|
594
|
+
* default: an example with no `kind` is a `demo`.
|
|
595
|
+
* @param {unknown} examples
|
|
596
|
+
* @returns {unknown}
|
|
597
|
+
*/
|
|
598
|
+
function withExampleKinds(examples) {
|
|
599
|
+
if (!Array.isArray(examples)) return examples;
|
|
600
|
+
return examples.map(example =>
|
|
601
|
+
example && typeof example === 'object'
|
|
602
|
+
? {...example, kind: example.kind ?? 'demo'}
|
|
603
|
+
: example,
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
592
607
|
/**
|
|
593
608
|
* Augment a loaded `component.detail` doc with ownership metadata. Adds
|
|
594
609
|
* `package`, the resolved `import` specifier, and `sourceAvailable` (whether a
|
|
595
610
|
* swizzleable source file exists for the owner). Existing doc fields (name,
|
|
596
|
-
* usage, props, …) are preserved
|
|
611
|
+
* usage, props, …) are preserved; each example carries its `kind`.
|
|
597
612
|
* @param {LoadedComponentDoc} docs
|
|
598
613
|
* @param {OwnershipSubject} owner
|
|
599
614
|
* @param {string} componentName
|
|
@@ -605,8 +620,20 @@ export function withOwnership(docs, owner, componentName, coreDir) {
|
|
|
605
620
|
owner.package === CORE_PACKAGE
|
|
606
621
|
? (docs.import ?? resolveImportPath(coreDir, componentName))
|
|
607
622
|
: resolveIntegrationImportPath(owner, componentName, docs.import);
|
|
623
|
+
/** @type {any} */
|
|
624
|
+
const doc = docs;
|
|
608
625
|
return /** @type {any} */ ({
|
|
609
626
|
...docs,
|
|
627
|
+
...(doc.examples ? {examples: withExampleKinds(doc.examples)} : {}),
|
|
628
|
+
...(Array.isArray(doc.components)
|
|
629
|
+
? {
|
|
630
|
+
components: doc.components.map((/** @type {any} */ entry) =>
|
|
631
|
+
entry?.examples
|
|
632
|
+
? {...entry, examples: withExampleKinds(entry.examples)}
|
|
633
|
+
: entry,
|
|
634
|
+
),
|
|
635
|
+
}
|
|
636
|
+
: {}),
|
|
610
637
|
package: owner.package,
|
|
611
638
|
import: importSpec,
|
|
612
639
|
sourceAvailable: owner.sourcePath != null,
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A doctor check that reads only files, kept between runs through the kept
|
|
6
|
+
* gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
|
|
7
|
+
* folder, module and environment variable it read unchanged reads the check
|
|
8
|
+
* back. Only the docs checks go through here; a check that depends on the
|
|
9
|
+
* time, the network or anything else the stamps do not see never does.
|
|
10
|
+
* @template T
|
|
11
|
+
* @param {{name: string, cwd: string, coreDir: string | null}} where - The
|
|
12
|
+
* check, the project folder, and the Core folder the project loads.
|
|
13
|
+
* @param {() => Promise<T>} check
|
|
14
|
+
* @returns {Promise<T>}
|
|
15
|
+
*/
|
|
16
|
+
export function keptFileCheck<T>({ name, cwd, coreDir }: {
|
|
17
|
+
name: string;
|
|
18
|
+
cwd: string;
|
|
19
|
+
coreDir: string | null;
|
|
20
|
+
}, check: () => Promise<T>): Promise<T>;
|
|
4
21
|
/**
|
|
5
22
|
* Package written to the generated app record for one discovered theme.
|
|
6
23
|
* @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
|
package/api/doctor/_adapter.mjs
CHANGED
|
@@ -45,6 +45,11 @@ export {unlistedIconSets} from '../../foundation/discovery/icon-set-discovery.mj
|
|
|
45
45
|
import {elementPropOrigins} from '../../foundation/discovery/module-exports.mjs';
|
|
46
46
|
import {cssImports} from '../../foundation/render/embedded-imports.mjs';
|
|
47
47
|
import * as path from 'node:path';
|
|
48
|
+
import {
|
|
49
|
+
persistedGather,
|
|
50
|
+
recordedRun,
|
|
51
|
+
} from '../../foundation/fs/gather-cache.mjs';
|
|
52
|
+
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
48
53
|
import {
|
|
49
54
|
Project,
|
|
50
55
|
availableComputerIntegrations,
|
|
@@ -83,6 +88,36 @@ export {
|
|
|
83
88
|
authoringAuditData,
|
|
84
89
|
} from './_authoring-audit.mjs';
|
|
85
90
|
|
|
91
|
+
/** A doctor check record, kept as it is. */
|
|
92
|
+
const CHECK_CODEC = {
|
|
93
|
+
encode: (/** @type {any} */ check) => check,
|
|
94
|
+
decode: (/** @type {any} */ check) => check,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A doctor check that reads only files, kept between runs through the kept
|
|
99
|
+
* gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
|
|
100
|
+
* folder, module and environment variable it read unchanged reads the check
|
|
101
|
+
* back. Only the docs checks go through here; a check that depends on the
|
|
102
|
+
* time, the network or anything else the stamps do not see never does.
|
|
103
|
+
* @template T
|
|
104
|
+
* @param {{name: string, cwd: string, coreDir: string | null}} where - The
|
|
105
|
+
* check, the project folder, and the Core folder the project loads.
|
|
106
|
+
* @param {() => Promise<T>} check
|
|
107
|
+
* @returns {Promise<T>}
|
|
108
|
+
*/
|
|
109
|
+
export function keptFileCheck({name, cwd, coreDir}, check) {
|
|
110
|
+
// Only a recorded run (a plain `doctor` from the bin) reads or keeps one: a
|
|
111
|
+
// hosted run names its commands its own way, so it always checks.
|
|
112
|
+
if (!recordedRun()) return check();
|
|
113
|
+
return persistedGather(
|
|
114
|
+
// With the command name the checks print commands with.
|
|
115
|
+
['doctor-check', name, cwd, coreDir, getCliInvocation(cwd)],
|
|
116
|
+
check,
|
|
117
|
+
CHECK_CODEC,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
86
121
|
/**
|
|
87
122
|
* Package written to the generated app record for one discovered theme.
|
|
88
123
|
* @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
|
package/api/doctor/doctor.mjs
CHANGED
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
COMPUTER_INSTALL_STEP,
|
|
101
101
|
} from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
102
102
|
import {
|
|
103
|
+
keptFileCheck,
|
|
103
104
|
alignCommand,
|
|
104
105
|
addCliCommandFor,
|
|
105
106
|
computerAgentTextState,
|
|
@@ -2192,7 +2193,7 @@ export function checkGatherCache() {
|
|
|
2192
2193
|
id: 'gather-cache',
|
|
2193
2194
|
label: 'Kept catalog cache',
|
|
2194
2195
|
status: 'info',
|
|
2195
|
-
message: `search, build, component, template, theme and
|
|
2196
|
+
message: `search, build, component, template, theme, discover and doctor keep what they gather (search's catalogs, each integration's check results, and doctor's docs checks) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, and deleting the folder clears it.`,
|
|
2196
2197
|
};
|
|
2197
2198
|
}
|
|
2198
2199
|
|
|
@@ -2465,9 +2466,22 @@ export async function runChecks(options = {}) {
|
|
|
2465
2466
|
);
|
|
2466
2467
|
}
|
|
2467
2468
|
checks.push(await checkAuthoringDocs(ctx));
|
|
2468
|
-
checks
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
// The checks that read only files, each kept while every file it read is
|
|
2470
|
+
// unchanged; the Core the project loads is part of what they read.
|
|
2471
|
+
const where = {cwd, coreDir: coreDir ?? null};
|
|
2472
|
+
checks.push(
|
|
2473
|
+
await keptFileCheck({name: 'cli-docs', ...where}, () => checkCliDocs(ctx)),
|
|
2474
|
+
);
|
|
2475
|
+
checks.push(
|
|
2476
|
+
await keptFileCheck({name: 'docs-tree', ...where}, () =>
|
|
2477
|
+
checkDocsTree(ctx),
|
|
2478
|
+
),
|
|
2479
|
+
);
|
|
2480
|
+
checks.push(
|
|
2481
|
+
await keptFileCheck({name: 'docs-progressive', ...where}, () =>
|
|
2482
|
+
checkDocsProgressiveDisclosure(ctx),
|
|
2483
|
+
),
|
|
2484
|
+
);
|
|
2471
2485
|
|
|
2472
2486
|
const summary = {pass: 0, warn: 0, fail: 0, info: 0};
|
|
2473
2487
|
for (const c of checks) summary[c.status] += 1;
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from '../../foundation/discovery/theme-imports.mjs';
|
|
58
58
|
import {
|
|
59
59
|
normalizeThemeBuildForCompare,
|
|
60
|
-
|
|
60
|
+
themeBuildWithHandOff,
|
|
61
61
|
} from '../theme/build/build.mjs';
|
|
62
62
|
import {
|
|
63
63
|
discoverIntegrationComponents,
|
|
@@ -641,8 +641,12 @@ async function validateIncompleteThemeExports(
|
|
|
641
641
|
if (outputs.some(output => output.kind !== 'font stylesheet')) {
|
|
642
642
|
// The scratch directory is the write root; the package stays the cwd,
|
|
643
643
|
// so the build selects the package's Core and its paths as before.
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const receipt = await themeBuildWithHandOff(
|
|
645
|
+
source,
|
|
646
|
+
{out: expectedCss},
|
|
647
|
+
{cwd: packageDir},
|
|
648
|
+
{writeRoot: expectedDir},
|
|
649
|
+
);
|
|
646
650
|
if (receipt == null || receipt.type !== 'theme.build') {
|
|
647
651
|
throw new Error('the theme build produced no complete receipt');
|
|
648
652
|
}
|
|
@@ -1079,10 +1083,12 @@ async function validatePackedThemeExports(
|
|
|
1079
1083
|
try {
|
|
1080
1084
|
// The scratch directory is the write root; the package stays the cwd,
|
|
1081
1085
|
// so the build selects the package's Core and its paths as before.
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
+
const receipt = await themeBuildWithHandOff(
|
|
1087
|
+
source,
|
|
1088
|
+
{out: expectedCss},
|
|
1089
|
+
{cwd: localIntegration.__packageDir},
|
|
1090
|
+
{writeRoot: expectedDir},
|
|
1091
|
+
);
|
|
1086
1092
|
if (receipt == null || receipt.type !== 'theme.build') {
|
|
1087
1093
|
issues.push(
|
|
1088
1094
|
error(
|
|
@@ -293,7 +293,7 @@ async function findUnreachableContributionIssues(
|
|
|
293
293
|
issues.push(
|
|
294
294
|
warning(
|
|
295
295
|
'unreachable_contribution',
|
|
296
|
-
`Found contribution metadata "${path.relative(packageDir, full)}" outside every declared integration root, so it contributes nothing. ${unreachableFix(context, full, stamp)}`,
|
|
296
|
+
`Found contribution metadata "${path.relative(packageDir, full).split(path.sep).join('/')}" outside every declared integration root, so it contributes nothing. ${unreachableFix(context, full, stamp)}`,
|
|
297
297
|
),
|
|
298
298
|
);
|
|
299
299
|
}
|
package/api/theme/_adapter.d.mts
CHANGED
|
@@ -78,8 +78,10 @@ export function listUnmigratedThemeCopies(cwd: string): import("../../foundation
|
|
|
78
78
|
* @param {{cwd: string, targetPath?: string, overwrite?: boolean, takenSlugs?: Set<string>}} options
|
|
79
79
|
* `takenSlugs`: the slugs of the themes the project can use, which a fork's
|
|
80
80
|
* new folder name may not take
|
|
81
|
-
* @returns {{outputDir: string, files: string[]
|
|
82
|
-
* directory
|
|
81
|
+
* @returns {{outputDir: string, files: string[], editorFolder: string | null}}
|
|
82
|
+
* the output directory relative to the working folder, the files written,
|
|
83
|
+
* named as the fork names them, and the folder the theme editor made that
|
|
84
|
+
* holds the fork, relative to the working folder, or null
|
|
83
85
|
*/
|
|
84
86
|
export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme, { cwd, targetPath: typedPath, overwrite, takenSlugs }: {
|
|
85
87
|
cwd: string;
|
|
@@ -89,6 +91,7 @@ export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-
|
|
|
89
91
|
}): {
|
|
90
92
|
outputDir: string;
|
|
91
93
|
files: string[];
|
|
94
|
+
editorFolder: string | null;
|
|
92
95
|
};
|
|
93
96
|
/**
|
|
94
97
|
* The packages the fork imports that the app does not declare. A fork that
|
package/api/theme/_adapter.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import {createRequire} from 'node:module';
|
|
|
16
16
|
import {
|
|
17
17
|
findCarriedCoreDir,
|
|
18
18
|
findPackageRoot,
|
|
19
|
+
projectWritePath,
|
|
19
20
|
requireCoreDir,
|
|
20
21
|
} from '../../foundation/fs/paths.mjs';
|
|
21
22
|
import {tryLock, userCacheDir} from '../../foundation/release/cache.mjs';
|
|
@@ -645,8 +646,10 @@ function themeDescriptorName(file) {
|
|
|
645
646
|
* @param {{cwd: string, targetPath?: string, overwrite?: boolean, takenSlugs?: Set<string>}} options
|
|
646
647
|
* `takenSlugs`: the slugs of the themes the project can use, which a fork's
|
|
647
648
|
* new folder name may not take
|
|
648
|
-
* @returns {{outputDir: string, files: string[]
|
|
649
|
-
* directory
|
|
649
|
+
* @returns {{outputDir: string, files: string[], editorFolder: string | null}}
|
|
650
|
+
* the output directory relative to the working folder, the files written,
|
|
651
|
+
* named as the fork names them, and the folder the theme editor made that
|
|
652
|
+
* holds the fork, relative to the working folder, or null
|
|
650
653
|
*/
|
|
651
654
|
export function ejectThemeFiles(
|
|
652
655
|
theme,
|
|
@@ -655,15 +658,17 @@ export function ejectThemeFiles(
|
|
|
655
658
|
// The fork lands in the project, as list and add read it: the default root
|
|
656
659
|
// is the project's, and a relative [path] is read from the working folder
|
|
657
660
|
// but must stay inside the project.
|
|
658
|
-
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
661
|
+
// Read as every theme command reads a path it writes; a backslash
|
|
662
|
+
// separates folders on every platform.
|
|
663
|
+
const {
|
|
664
|
+
projectDir,
|
|
665
|
+
typed: targetPath,
|
|
666
|
+
relative: target,
|
|
667
|
+
} = projectWritePath(
|
|
668
|
+
cwd,
|
|
669
|
+
typedPath || undefined,
|
|
670
|
+
defaultEjectTarget(theme.slug),
|
|
671
|
+
);
|
|
667
672
|
let resolvedDir;
|
|
668
673
|
try {
|
|
669
674
|
resolvedDir = assertWithin(target, projectDir, {
|
|
@@ -830,7 +835,33 @@ export function ejectThemeFiles(
|
|
|
830
835
|
throw new AstryxError(message, undefined, ERROR_CODES.ERR_WRITE_FAILED);
|
|
831
836
|
}
|
|
832
837
|
|
|
833
|
-
|
|
838
|
+
const editorDir = enclosingEditorFolder(resolvedDir, projectDir);
|
|
839
|
+
return {
|
|
840
|
+
outputDir: path.relative(cwd, resolvedDir) || '.',
|
|
841
|
+
files: names,
|
|
842
|
+
editorFolder:
|
|
843
|
+
editorDir == null ? null : path.relative(cwd, editorDir) || '.',
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* The nearest folder above `dir`, up to the project root, that the theme
|
|
849
|
+
* editor made, or null. Eject refuses the editor's folder itself; a subfolder
|
|
850
|
+
* of it is written as released CLIs did, with a warning.
|
|
851
|
+
* @param {string} dir
|
|
852
|
+
* @param {string} projectDir
|
|
853
|
+
* @returns {string | null}
|
|
854
|
+
*/
|
|
855
|
+
function enclosingEditorFolder(dir, projectDir) {
|
|
856
|
+
const root = path.resolve(projectDir);
|
|
857
|
+
let current = path.resolve(dir);
|
|
858
|
+
while (current !== root) {
|
|
859
|
+
const parent = path.dirname(current);
|
|
860
|
+
if (parent === current) return null;
|
|
861
|
+
current = parent;
|
|
862
|
+
if (editorThemeRecord(current)) return current;
|
|
863
|
+
}
|
|
864
|
+
return null;
|
|
834
865
|
}
|
|
835
866
|
|
|
836
867
|
/**
|
|
@@ -68,6 +68,19 @@ export function themeSourceFiles(filePath: string): string[];
|
|
|
68
68
|
* @returns {string[]} at most three paths
|
|
69
69
|
*/
|
|
70
70
|
export function themeSourceGuesses(file: string, cwd: string): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Hand the theme editor warnings of the builds in this process to
|
|
73
|
+
* `listener` instead of the logger. CLI-internal: the watch child's
|
|
74
|
+
* hand-off to its parent.
|
|
75
|
+
* @param {((warning: string) => void) | null} listener
|
|
76
|
+
*/
|
|
77
|
+
export function setEditorFolderListener(listener: ((warning: string) => void) | null): void;
|
|
78
|
+
/**
|
|
79
|
+
* Tell `listener` when a build in this process finds private var errors.
|
|
80
|
+
* CLI-internal.
|
|
81
|
+
* @param {(() => void) | null} listener
|
|
82
|
+
*/
|
|
83
|
+
export function setPrivateVarErrorListener(listener: (() => void) | null): void;
|
|
71
84
|
/**
|
|
72
85
|
* Publish the outputs a batch deferred, one theme at a time, in build order.
|
|
73
86
|
* @param {Array<Array<{dest: string, content: string}>>} deferred
|
|
@@ -155,6 +168,7 @@ export function printCompactTrailer(trailers: ThemeBuildTrailer[], { hint }?: {
|
|
|
155
168
|
* @param {{out?: string, check?: boolean, iconsSpecifier?: string}} [options]
|
|
156
169
|
* @param {{cwd?: string}} [ctx]
|
|
157
170
|
* @param {{compact?: boolean}} [report]
|
|
171
|
+
* @param {ThemeBuildHandOff} [handOff]
|
|
158
172
|
* @returns {Promise<{receipt: import('../theme.type.mjs').ThemeBuildResponse | import('../theme.type.mjs').ThemeBuildCheckResponse | null, trailer: ThemeBuildTrailer | null}>}
|
|
159
173
|
*/
|
|
160
174
|
export function themeBuildForReport(file: string, options?: {
|
|
@@ -165,7 +179,7 @@ export function themeBuildForReport(file: string, options?: {
|
|
|
165
179
|
cwd?: string;
|
|
166
180
|
}, { compact }?: {
|
|
167
181
|
compact?: boolean;
|
|
168
|
-
}): Promise<{
|
|
182
|
+
}, handOff?: ThemeBuildHandOff): Promise<{
|
|
169
183
|
receipt: import("../theme.type.mjs").ThemeBuildResponse | import("../theme.type.mjs").ThemeBuildCheckResponse | null;
|
|
170
184
|
trailer: ThemeBuildTrailer | null;
|
|
171
185
|
}>;
|
|
@@ -178,36 +192,37 @@ export function themeBuild(file: string, options?: {
|
|
|
178
192
|
cwd?: string;
|
|
179
193
|
projectCore?: boolean;
|
|
180
194
|
}): Promise<import("../theme.type.mjs").ThemeBuildResponse | import("../theme.type.mjs").ThemeBuildCheckResponse | null>;
|
|
181
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* {@link themeBuild} with the CLI's hand-off: the same build, outputs, and
|
|
197
|
+
* receipt, plus what only the CLI's batch and scratch builds pass.
|
|
198
|
+
* CLI-internal: not exported from the API entry.
|
|
199
|
+
* @param {string} file
|
|
200
|
+
* @param {{out?: string, check?: boolean, iconsSpecifier?: string}} options
|
|
201
|
+
* @param {{cwd?: string, projectCore?: boolean}} ctx
|
|
202
|
+
* @param {ThemeBuildHandOff} handOff
|
|
203
|
+
* @returns {Promise<import('../theme.type.mjs').ThemeBuildResponse | import('../theme.type.mjs').ThemeBuildCheckResponse | null>}
|
|
204
|
+
*/
|
|
205
|
+
export function themeBuildWithHandOff(file: string, options: {
|
|
206
|
+
out?: string;
|
|
207
|
+
check?: boolean;
|
|
208
|
+
iconsSpecifier?: string;
|
|
209
|
+
}, ctx: {
|
|
210
|
+
cwd?: string;
|
|
211
|
+
projectCore?: boolean;
|
|
212
|
+
}, handOff: ThemeBuildHandOff): Promise<import("../theme.type.mjs").ThemeBuildResponse | import("../theme.type.mjs").ThemeBuildCheckResponse | null>;
|
|
213
|
+
/** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string}} options @param {{cwd?: string}} [ctx] @param {{commandWords?: {group: string, build: string}}} [handOff] - the CLI's words for the rebuild hint */
|
|
182
214
|
export function themeBuildFamily(files: string[], options: {
|
|
183
215
|
familyKey: string;
|
|
184
216
|
check?: boolean;
|
|
185
217
|
iconsSpecifier?: string;
|
|
186
|
-
__onPrivateVarError?: () => void;
|
|
187
|
-
__commandWords?: {
|
|
188
|
-
group: string;
|
|
189
|
-
build: string;
|
|
190
|
-
};
|
|
191
218
|
}, { cwd }?: {
|
|
192
219
|
cwd?: string;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
upToDate: boolean;
|
|
198
|
-
stale: {
|
|
199
|
-
path: string;
|
|
200
|
-
reason: "missing" | "outdated";
|
|
201
|
-
}[];
|
|
202
|
-
checked: string[];
|
|
203
|
-
tokenCount?: undefined;
|
|
204
|
-
componentCount?: undefined;
|
|
205
|
-
sizeKB?: undefined;
|
|
206
|
-
outputs?: undefined;
|
|
207
|
-
warnings?: undefined;
|
|
208
|
-
notices?: undefined;
|
|
220
|
+
}, handOff?: {
|
|
221
|
+
commandWords?: {
|
|
222
|
+
group: string;
|
|
223
|
+
build: string;
|
|
209
224
|
};
|
|
210
|
-
} | {
|
|
225
|
+
}): Promise<import("../theme.type.mjs").ThemeBuildCheckResponse | {
|
|
211
226
|
type: string;
|
|
212
227
|
data: {
|
|
213
228
|
name: any;
|
|
@@ -222,9 +237,6 @@ export function themeBuildFamily(files: string[], options: {
|
|
|
222
237
|
};
|
|
223
238
|
warnings: any[];
|
|
224
239
|
notices: string[];
|
|
225
|
-
upToDate?: undefined;
|
|
226
|
-
stale?: undefined;
|
|
227
|
-
checked?: undefined;
|
|
228
240
|
};
|
|
229
241
|
}>;
|
|
230
242
|
/**
|
|
@@ -287,3 +299,28 @@ export type ThemeBuildTrailer = {
|
|
|
287
299
|
*/
|
|
288
300
|
fontNotices: string[];
|
|
289
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* What the CLI hands a build beyond themeBuild's options. CLI-internal, never
|
|
304
|
+
* a themeBuild option: `claimedOutputs` records the outputs earlier builds in
|
|
305
|
+
* one run wrote, so a later theme cannot replace them; with `deferredWrites`
|
|
306
|
+
* the build adds its outputs to that list instead of writing them, for
|
|
307
|
+
* writeDeferredBuildOutputs; `writeRoot` replaces `cwd` as the directory every
|
|
308
|
+
* output must stay inside, for a scratch build; `commandWords` names the
|
|
309
|
+
* command in the rebuild hint; `prepareFamily`, `familyLoader`, and
|
|
310
|
+
* `familyInterception` make the build a family member's plan.
|
|
311
|
+
*/
|
|
312
|
+
export type ThemeBuildHandOff = {
|
|
313
|
+
prepareFamily?: boolean;
|
|
314
|
+
familyLoader?: any;
|
|
315
|
+
familyInterception?: any;
|
|
316
|
+
writeRoot?: string;
|
|
317
|
+
claimedOutputs?: Map<string, string>;
|
|
318
|
+
deferredWrites?: Array<Array<{
|
|
319
|
+
dest: string;
|
|
320
|
+
content: string;
|
|
321
|
+
}>>;
|
|
322
|
+
commandWords?: {
|
|
323
|
+
group: string;
|
|
324
|
+
build: string;
|
|
325
|
+
};
|
|
326
|
+
};
|