@astryxdesign/cli 0.7.14 → 0.7.15-canary.g06b7e61
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 +3 -3
- package/README.md +63 -63
- package/api/build/_adapter.d.mts +4 -0
- package/api/build/_adapter.mjs +28 -2
- package/api/build/blocks/blocks.d.mts +10 -1
- package/api/build/blocks/blocks.mjs +84 -7
- package/api/build/build.mjs +6 -1
- package/api/build/tree.d.mts +4 -0
- package/api/build/tree.mjs +9 -2
- package/api/doctor/_adapter.d.mts +3 -1
- package/api/doctor/_adapter.mjs +14 -1
- package/api/doctor/_authoring-audit.d.mts +42 -0
- package/api/doctor/_authoring-audit.mjs +106 -0
- package/api/doctor/doctor.d.mts +7 -0
- package/api/doctor/doctor.mjs +24 -39
- package/api/doctor/theme-checks.mjs +56 -21
- package/api/integration/add-helpers.mjs +5 -0
- package/api/integration/add-theme.mjs +15 -110
- package/api/integration/validate-integration.mjs +17 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_adapter.mjs +124 -3
- package/api/search/_candidate-score.mjs +63 -9
- package/api/search/_entries.d.mts +10 -0
- package/api/search/_entries.mjs +68 -1
- package/api/search/_gather-templates.d.mts +11 -0
- package/api/search/_gather-templates.mjs +22 -2
- package/api/search/_words.mjs +26 -6
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/theme/_adapter.d.mts +37 -5
- package/api/theme/_adapter.mjs +381 -57
- package/api/theme/_fork.d.mts +90 -0
- package/api/theme/_fork.mjs +246 -0
- package/api/theme/build/build.d.mts +40 -2
- package/api/theme/build/build.mjs +477 -66
- package/api/theme/eject/eject.mjs +36 -15
- package/api/theme/list/list.mjs +3 -6
- package/api/theme/palette/generate/generator.d.mts +13 -0
- package/api/theme/palette/generate/generator.mjs +32 -2
- package/api/theme/targets/targets.d.mts +8 -0
- package/api/theme/targets/targets.mjs +24 -4
- package/api/theme/template/template.mjs +48 -2
- package/api/theme/theme.type.d.mts +8 -0
- package/api/theme/theme.type.mjs +5 -1
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeEject.doc.mjs +3 -3
- package/api/theme/themeRemove.doc.mjs +5 -2
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +2 -2
- package/api/theme/themeUse.doc.mjs +8 -2
- package/api/theme-edit/_adapter.d.mts +46 -3
- package/api/theme-edit/_adapter.mjs +496 -112
- package/api/theme-edit/_catalog.d.mts +1 -6
- package/api/theme-edit/_catalog.mjs +5 -268
- package/api/theme-edit/_check.d.mts +9 -4
- package/api/theme-edit/_check.mjs +1232 -229
- package/api/theme-edit/_color.d.mts +19 -0
- package/api/theme-edit/_color.mjs +280 -34
- package/api/theme-edit/_compiler.d.mts +3 -1
- package/api/theme-edit/_compiler.mjs +52 -13
- package/api/theme-edit/_context.d.mts +4 -1
- package/api/theme-edit/_context.mjs +126 -13
- package/api/theme-edit/_css.d.mts +84 -0
- package/api/theme-edit/_css.mjs +700 -0
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +806 -103
- package/api/theme-edit/_how-commands.d.mts +38 -7
- package/api/theme-edit/_how-commands.mjs +64 -45
- package/api/theme-edit/_how-question.d.mts +33 -0
- package/api/theme-edit/_how-question.mjs +2553 -381
- package/api/theme-edit/_how.mjs +402 -31
- package/api/theme-edit/_overview.mjs +2 -7
- package/api/theme-edit/_palette.d.mts +60 -13
- package/api/theme-edit/_palette.mjs +826 -295
- package/api/theme-edit/_parts.d.mts +42 -10
- package/api/theme-edit/_parts.mjs +280 -69
- package/api/theme-edit/_png.d.mts +4 -4
- package/api/theme-edit/_png.mjs +4 -2
- package/api/theme-edit/_preview-app.d.mts +14 -0
- package/api/theme-edit/_preview-app.mjs +1675 -235
- package/api/theme-edit/_preview.d.mts +7 -16
- package/api/theme-edit/_preview.mjs +79 -86
- package/api/theme-edit/_project.d.mts +32 -2
- package/api/theme-edit/_project.mjs +80 -19
- package/api/theme-edit/_settings.d.mts +199 -52
- package/api/theme-edit/_settings.mjs +1422 -217
- package/api/theme-edit/_tables.d.mts +19 -6
- package/api/theme-edit/_tables.mjs +150 -92
- package/api/theme-edit/theme-edit.type.d.mts +20 -1
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
- package/api/theme-edit/themeEditSet.doc.mjs +1 -1
- package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
- package/api/upgrade/_adapter.d.mts +1 -0
- package/assets/codemods/run-codemod.mjs +61 -0
- package/assets/codemods/runner.mjs +5 -4
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
- package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
- package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
- package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
- package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
- package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
- package/assets/docs/tree/calendars.doc.mjs +1 -3
- package/assets/docs/tree/checks.doc.mjs +22 -1
- package/assets/docs/tree/publishing.doc.mjs +1 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -1
- package/assets/preview-app/next.config.mjs +7 -1
- package/assets/self-audit.generated.json +1 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
- package/assets/templates/components.generated.json +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +8 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +19 -15
- package/clients/cli/build-id.generated.json +1 -0
- package/clients/cli/commands/ensure-core-built.mjs +12 -5
- package/clients/cli/commands/experimental/index.mjs +10 -10
- package/clients/cli/commands/experimental/theme.mjs +200 -81
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
- package/clients/cli/commands/integration.mjs +8 -0
- package/clients/cli/commands/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +439 -66
- package/clients/cli/index.mjs +27 -6
- package/clients/cli/lib/cli-error.mjs +118 -3
- package/clients/cli/lib/manifest.mjs +37 -0
- package/clients/cli/lib/resolve-theme.mjs +2 -1
- package/clients/cli/manifest.generated.json +1 -0
- package/foundation/config/project.mjs +34 -8
- package/foundation/config/theme-state.d.mts +16 -0
- package/foundation/config/theme-state.mjs +84 -13
- package/foundation/discovery/module-exports.mjs +16 -2
- package/foundation/discovery/stored-self-audit.d.mts +31 -0
- package/foundation/discovery/stored-self-audit.mjs +119 -0
- package/foundation/discovery/template-adapter.d.mts +48 -2
- package/foundation/discovery/template-adapter.mjs +51 -19
- package/foundation/discovery/template-needs.d.mts +19 -0
- package/foundation/discovery/template-needs.mjs +50 -16
- package/foundation/discovery/template-source-tree.d.mts +7 -0
- package/foundation/discovery/template-source-tree.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +2 -1
- package/foundation/discovery/theme-discovery.mjs +16 -10
- package/foundation/discovery/theme-imports.d.mts +16 -0
- package/foundation/discovery/theme-imports.mjs +30 -2
- package/foundation/discovery/theme-module-extensions.d.mts +18 -0
- package/foundation/discovery/theme-module-extensions.mjs +30 -0
- package/foundation/doc-compiler/import.mjs +22 -15
- package/foundation/doc-compiler/stored-docs.d.mts +18 -12
- package/foundation/doc-compiler/stored-docs.mjs +52 -19
- package/foundation/env/private-dir.d.mts +17 -0
- package/foundation/env/private-dir.mjs +42 -0
- package/foundation/fs/gather-cache.d.mts +108 -0
- package/foundation/fs/gather-cache.mjs +783 -0
- package/foundation/fs/jiti-cache.d.mts +21 -0
- package/foundation/fs/jiti-cache.mjs +66 -0
- package/foundation/fs/module-loader.mjs +14 -3
- package/foundation/fs/read-record.d.mts +31 -1
- package/foundation/fs/read-record.mjs +100 -7
- package/foundation/integrations/autolink.d.mts +1 -24
- package/foundation/integrations/autolink.mjs +7 -60
- package/foundation/integrations/declared-dependencies.d.mts +27 -0
- package/foundation/integrations/declared-dependencies.mjs +73 -0
- package/foundation/integrations/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/may-have-integrations.d.mts +8 -0
- package/foundation/integrations/may-have-integrations.mjs +47 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +32 -4
- package/foundation/release/cache.mjs +105 -16
- package/foundation/release/folder-lock.d.mts +28 -0
- package/foundation/release/folder-lock.mjs +205 -0
- package/foundation/release/lock-lease.d.mts +2 -1
- package/foundation/release/lock-lease.mjs +7 -2
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +8 -6
- package/api/theme-edit/_css-properties.d.mts +0 -10
- package/api/theme-edit/_css-properties.mjs +0 -556
|
@@ -336,6 +336,59 @@ export function runConfigCodemod(
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* A codemod as `upgrade` runs it. Core codemods may also declare `mentions`,
|
|
341
|
+
* internal to the CLI and not part of the codemod authoring type: the words a
|
|
342
|
+
* file must say for the transform to change or report it. A file that says
|
|
343
|
+
* none of them, holds no backslash, and parses, is skipped.
|
|
344
|
+
* @typedef {import('../../authoring/codemod/type').CodemodEntry['codemod'] & {mentions?: string[]}} CoreCodemod
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Whether a file parses as its codemod's transform would parse it, by parser
|
|
349
|
+
* and file, while its text is the same: each file is parsed once for every
|
|
350
|
+
* codemod that skips it.
|
|
351
|
+
* @type {Map<string, {source: string, parses: boolean}>}
|
|
352
|
+
*/
|
|
353
|
+
const parsedOnce = new Map();
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Whether a codemod cannot change a source file, so its transform need not
|
|
357
|
+
* run (stylesheets always run, whatever they parse as): the
|
|
358
|
+
* codemod declares every word a file must say for it to act (`mentions`), the
|
|
359
|
+
* file says none of them and holds no backslash (no escape can spell one),
|
|
360
|
+
* and the file parses, so the transform would neither
|
|
361
|
+
* change it nor report it unparseable. A codemod that declares no words runs
|
|
362
|
+
* on every file.
|
|
363
|
+
* @param {CoreCodemod} codemod
|
|
364
|
+
* @param {string} source
|
|
365
|
+
* @param {string} filePath
|
|
366
|
+
* @param {string} parser
|
|
367
|
+
* @param {any} j jscodeshift bound to the file's parser
|
|
368
|
+
* @returns {boolean}
|
|
369
|
+
*/
|
|
370
|
+
function cannotChange(codemod, source, filePath, parser, j) {
|
|
371
|
+
const {mentions} = codemod;
|
|
372
|
+
if (!Array.isArray(mentions) || mentions.length === 0) return false;
|
|
373
|
+
if (mentions.some(word => source.includes(word))) return false;
|
|
374
|
+
// An escape (`\u0054ypeahead`, `'base\x2dtable'`, a line continuation)
|
|
375
|
+
// can spell a word without its letters: such a file always runs.
|
|
376
|
+
if (source.includes('\\')) return false;
|
|
377
|
+
const key = `${parser}\0${filePath}`;
|
|
378
|
+
let known = parsedOnce.get(key);
|
|
379
|
+
if (known?.source !== source) {
|
|
380
|
+
let parses = true;
|
|
381
|
+
try {
|
|
382
|
+
j(source);
|
|
383
|
+
} catch {
|
|
384
|
+
parses = false;
|
|
385
|
+
}
|
|
386
|
+
known = {source, parses};
|
|
387
|
+
parsedOnce.set(key, known);
|
|
388
|
+
}
|
|
389
|
+
return known.parses;
|
|
390
|
+
}
|
|
391
|
+
|
|
339
392
|
/**
|
|
340
393
|
* Apply a code codemod to discovered source files.
|
|
341
394
|
*
|
|
@@ -380,6 +433,14 @@ export function runCodeCodemod(
|
|
|
380
433
|
contents?.get(filePath) ?? fs.readFileSync(filePath, 'utf-8');
|
|
381
434
|
const parser = ext === '.tsx' || ext === '.ts' ? 'tsx' : 'babel';
|
|
382
435
|
const j = jscodeshift.withParser(parser);
|
|
436
|
+
// Only source files: a stylesheet can happen to parse as JavaScript
|
|
437
|
+
// (`a.b` then `{ color: white; }`), yet its transform still changes it.
|
|
438
|
+
if (
|
|
439
|
+
PARSEABLE_EXTENSIONS.includes(ext) &&
|
|
440
|
+
cannotChange(codemod, source, filePath, parser, j)
|
|
441
|
+
) {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
383
444
|
const api = {
|
|
384
445
|
jscodeshift: markingSourceParseErrors(j, source),
|
|
385
446
|
stats: () => {},
|
|
@@ -293,7 +293,7 @@ export function validateOutput(result, source, j, {parse = true} = {}) {
|
|
|
293
293
|
* with the same `(file, api) => string | null | undefined` contract used by a
|
|
294
294
|
* `type: 'config'` codemod.
|
|
295
295
|
*
|
|
296
|
-
* @param {{name: string, transform: import('../../authoring/codemod/type').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, optional?: boolean}} transformEntry
|
|
296
|
+
* @param {{name: string, transform: import('../../authoring/codemod/type').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string, mentions?: string[]}, optional?: boolean}} transformEntry
|
|
297
297
|
* @param {string} version
|
|
298
298
|
* @returns {import('../../authoring/codemod/type').CodemodEntry}
|
|
299
299
|
*/
|
|
@@ -308,6 +308,7 @@ function toUnifiedEntry(transformEntry, version) {
|
|
|
308
308
|
transform,
|
|
309
309
|
fileExtensions: meta.fileExtensions,
|
|
310
310
|
isOptional: !!optional,
|
|
311
|
+
...(meta.mentions ? {mentions: meta.mentions} : {}),
|
|
311
312
|
},
|
|
312
313
|
package: 'core',
|
|
313
314
|
version,
|
|
@@ -498,7 +499,7 @@ async function runProjectCodemod(
|
|
|
498
499
|
/**
|
|
499
500
|
* Run codemods against source files.
|
|
500
501
|
*
|
|
501
|
-
* @param {Array<{version: string, transforms: Array<{name: string, transform: import('../../authoring/codemod/type').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, optional?: boolean}>}>} versionManifests
|
|
502
|
+
* @param {Array<{version: string, transforms: Array<{name: string, transform: import('../../authoring/codemod/type').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string, mentions?: string[]}, optional?: boolean}>}>} versionManifests
|
|
502
503
|
* @param {object} options
|
|
503
504
|
* @param {boolean} options.apply - Write changes to disk
|
|
504
505
|
* @param {string} options.path - Source directory to scan
|
|
@@ -509,7 +510,7 @@ async function runProjectCodemod(
|
|
|
509
510
|
* @param {{root: string, classify: (file: string) => import('../../foundation/fs/file-protection.mjs').FileProtection[]}} [options.protection] - Preloaded protection resolver
|
|
510
511
|
* @param {boolean} [options.coversTarget] - False when these codemods stop before the installed target (the CLI is older than Core), so a run with no changes does not say the code is up to date. Default true.
|
|
511
512
|
* @param {unknown[]} [options.outcomes] - Findings the transforms reported instead of changing a file (manual migrations, files to regenerate), filled while the run goes. A run with any does not say the code is up to date; the caller lists them.
|
|
512
|
-
* @returns {Promise<{totalFilesChanged: number, totalTransformsApplied: number, totalValidationBlocked: number, changedFiles: string[], writtenFiles: string[], stagedContents: Map<string, string>, protectedFiles: import('../../authoring/codemod/type').CodemodRunResult['protectedFiles'], declinedCandidates: NonNullable<import('../../authoring/codemod/type').CodemodRunResult['declinedCandidates']>, errors: Array<{file: string, codemod: string, error: string}>, skippedOptional: Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, version: string}>} | {ok: false, reason: string, resolvedPath: string}>}
|
|
513
|
+
* @returns {Promise<{totalFilesChanged: number, totalTransformsApplied: number, totalValidationBlocked: number, changedFiles: string[], writtenFiles: string[], stagedContents: Map<string, string>, protectedFiles: import('../../authoring/codemod/type').CodemodRunResult['protectedFiles'], declinedCandidates: NonNullable<import('../../authoring/codemod/type').CodemodRunResult['declinedCandidates']>, errors: Array<{file: string, codemod: string, error: string}>, skippedOptional: Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string, mentions?: string[]}, version: string}>} | {ok: false, reason: string, resolvedPath: string}>}
|
|
513
514
|
*/
|
|
514
515
|
export async function runCodemods(
|
|
515
516
|
versionManifests,
|
|
@@ -593,7 +594,7 @@ export async function runCodemods(
|
|
|
593
594
|
const protectedFiles = [];
|
|
594
595
|
/** @type {NonNullable<import('../../authoring/codemod/type').CodemodRunResult['declinedCandidates']>} */
|
|
595
596
|
const declinedCandidates = [];
|
|
596
|
-
/** @type {Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, version: string}>} */
|
|
597
|
+
/** @type {Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string, mentions?: string[]}, version: string}>} */
|
|
597
598
|
const skippedOptional = [];
|
|
598
599
|
for (const {version, transforms} of versionManifests) {
|
|
599
600
|
log.step(`Applying v${version} codemods...`);
|
|
@@ -19,6 +19,9 @@ export const meta = {
|
|
|
19
19
|
'AvatarStatusDot, Icon, SVGIcon, ProgressBar, and Badge JSX elements. ' +
|
|
20
20
|
'Indirect values are left unchanged for manual migration.',
|
|
21
21
|
pr: '#996',
|
|
22
|
+
// A file changes only through a JSX `variant` or `color` prop
|
|
23
|
+
// (assets/codemods/run-codemod.mjs).
|
|
24
|
+
mentions: ['variant', 'color'],
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
|
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
import {transformProp} from '../../transform-prop.mjs';
|
|
15
15
|
|
|
16
16
|
export const meta = {
|
|
17
|
-
title:
|
|
17
|
+
title:
|
|
18
|
+
'Rename Avatar named sizes tiny/xsmall/small/medium/large → xsm/sm/md/lg/xl',
|
|
18
19
|
description:
|
|
19
20
|
'Renames static sizes written directly on imported Avatar and AvatarGroup ' +
|
|
20
21
|
'JSX elements. Indirect values are left unchanged for manual migration.',
|
|
21
22
|
pr: '#2672',
|
|
23
|
+
// A file changes only through a JSX `size` prop
|
|
24
|
+
// (assets/codemods/run-codemod.mjs).
|
|
25
|
+
mentions: ['size'],
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
const IMPORT_SOURCES = new Set([
|
|
@@ -21,6 +21,9 @@ export const meta = {
|
|
|
21
21
|
'and TimeInput, mapping touch→adaptive-native, always→native, and ' +
|
|
22
22
|
'never→adaptive-bottom-sheet (text-input for TimeInput). Dynamic ' +
|
|
23
23
|
'values are left for manual migration; the deprecated prop still works.',
|
|
24
|
+
// A file changes only through a JSX `nativePicker` prop
|
|
25
|
+
// (assets/codemods/run-codemod.mjs).
|
|
26
|
+
mentions: ['nativePicker'],
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
|
|
@@ -86,6 +86,10 @@ export const meta = {
|
|
|
86
86
|
description:
|
|
87
87
|
'Renames all 21 removed component target aliases in static theme maps and CSS, and replaces target-qualified bare prop/state classes with reflected data attributes.',
|
|
88
88
|
fileExtensions: ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs', '.css'],
|
|
89
|
+
// A source file changes only where a static key of a theme's components
|
|
90
|
+
// map names a removed target, so it writes that name. A stylesheet never
|
|
91
|
+
// parses as source, so it always runs (assets/codemods/run-codemod.mjs).
|
|
92
|
+
mentions: Object.keys(DEPRECATED_THEME_TARGETS),
|
|
89
93
|
};
|
|
90
94
|
|
|
91
95
|
const TODO_PREFIX = ' TODO(astryx upgrade): merge deprecated theme target ';
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* which is why every spread gets the TODO.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import {transformProp} from '../../transform-prop.mjs';
|
|
25
|
+
import {importedComponents, transformProp} from '../../transform-prop.mjs';
|
|
26
26
|
|
|
27
27
|
export const meta = {
|
|
28
28
|
title: 'Rename emptySearchResultsText to emptySearchText',
|
|
@@ -33,6 +33,10 @@ export const meta = {
|
|
|
33
33
|
'`triggers`. Leaves a TODO where the new name is already set, on every ' +
|
|
34
34
|
'spread onto these elements, where the triggers value is not written ' +
|
|
35
35
|
'inline, and on a trigger object with a spread or computed key.',
|
|
36
|
+
// A file changes only where it imports one of these components, which
|
|
37
|
+
// writes its name (`Typeahead` covers BaseTypeahead)
|
|
38
|
+
// (assets/codemods/run-codemod.mjs).
|
|
39
|
+
mentions: ['Tokenizer', 'Typeahead', 'ChatComposerInput'],
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
const OLD_NAME = 'emptySearchResultsText';
|
|
@@ -201,6 +205,15 @@ export default function transform(fileInfo, api) {
|
|
|
201
205
|
// `triggers`): the spread may carry the removed key, so it gets the TODO.
|
|
202
206
|
for (const [component, props] of COMPONENTS) {
|
|
203
207
|
const sentinel = `__astryx_spread_${component}`;
|
|
208
|
+
const only = {
|
|
209
|
+
matchesImport: (/** @type {string} */ source) =>
|
|
210
|
+
CORE_IMPORT_RE.test(source),
|
|
211
|
+
components: new Map([[component, new Set([sentinel])]]),
|
|
212
|
+
};
|
|
213
|
+
// A file that does not import the component holds no element of it: the
|
|
214
|
+
// check below would match nothing, so it is skipped.
|
|
215
|
+
const imported = importedComponents(root, j, only);
|
|
216
|
+
if (imported.direct.size === 0 && imported.namespaces.size === 0) continue;
|
|
204
217
|
root
|
|
205
218
|
.find(j.JSXOpeningElement)
|
|
206
219
|
.filter((/** @type {any} */ path) =>
|
|
@@ -222,17 +235,9 @@ export default function transform(fileInfo, api) {
|
|
|
222
235
|
const marker = j.jsxAttribute(j.jsxIdentifier(sentinel));
|
|
223
236
|
path.node.attributes = [...attributes, marker];
|
|
224
237
|
let matched = false;
|
|
225
|
-
transformProp(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{
|
|
229
|
-
matchesImport: source => CORE_IMPORT_RE.test(source),
|
|
230
|
-
components: new Map([[component, new Set([sentinel])]]),
|
|
231
|
-
},
|
|
232
|
-
propPath => {
|
|
233
|
-
if (propPath.node === marker) matched = true;
|
|
234
|
-
},
|
|
235
|
-
);
|
|
238
|
+
transformProp(root, j, only, propPath => {
|
|
239
|
+
if (propPath.node === marker) matched = true;
|
|
240
|
+
});
|
|
236
241
|
path.node.attributes = attributes;
|
|
237
242
|
if (!matched) return;
|
|
238
243
|
const spread = attributes.find(
|
|
@@ -34,6 +34,9 @@ export const meta = {
|
|
|
34
34
|
'with a TODO where `edge` is computed or a later spread may override ' +
|
|
35
35
|
'it, on a dynamic value, and where the List also spreads props; the ' +
|
|
36
36
|
'deprecated prop still works there.',
|
|
37
|
+
// A file can change only through a JSX `edgeCompensation` prop, so a file whose text
|
|
38
|
+
// never says `edgeCompensation` is left as it is (assets/codemods/run-codemod.mjs).
|
|
39
|
+
mentions: ['edgeCompensation'],
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
const OLD_NAME = 'edgeCompensation';
|
|
@@ -36,6 +36,9 @@ export const meta = {
|
|
|
36
36
|
'Keeps the old prop with a TODO where the language is computed, missing, ' +
|
|
37
37
|
'or `plaintext`, and where the CodeBlock also spreads props; the ' +
|
|
38
38
|
'deprecated prop still works there.',
|
|
39
|
+
// A file can change only through a JSX `tokenizer` prop, so a file whose text
|
|
40
|
+
// never says `tokenizer` is left as it is (assets/codemods/run-codemod.mjs).
|
|
41
|
+
mentions: ['tokenizer'],
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
const OLD_NAME = 'tokenizer';
|
|
@@ -27,6 +27,9 @@ export const meta = {
|
|
|
27
27
|
'`presentation={x}`; Tokenizer no longer reads `experimental`. Leaves a ' +
|
|
28
28
|
'TODO where the experimental value is not an object literal, where the ' +
|
|
29
29
|
'Tokenizer already passes presentation, and where it spreads props.',
|
|
30
|
+
// A file can change only through a JSX `experimental` prop, so a file whose text
|
|
31
|
+
// never says `experimental` is left as it is (assets/codemods/run-codemod.mjs).
|
|
32
|
+
mentions: ['experimental'],
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
export const docs = {
|
|
12
12
|
type: 'namespace',
|
|
13
13
|
name: 'calendars',
|
|
14
|
-
|
|
15
|
-
// Internationalization, the page that links here.
|
|
16
|
-
title: 'Internationalization: calendars',
|
|
14
|
+
title: 'Calendars',
|
|
17
15
|
summary:
|
|
18
16
|
'Show dates in the Persian, Hebrew, Hijri, Buddhist, Japanese, Chinese, Dangi, and other calendars while values stay Gregorian ISO dates.',
|
|
19
17
|
keywords: [
|
|
@@ -30,7 +30,7 @@ export const docs = {
|
|
|
30
30
|
rows: [
|
|
31
31
|
[
|
|
32
32
|
'`{@command doctor integration validate}`',
|
|
33
|
-
'The manifest loads, each root holds contributions the CLI can read, and each doc matches its authoring type. Notes list a malformed `cliCommand` (`invalid_cli_command`) and, for each topic, a command written with a package runner (`runner_command`), bare (`plain_command`) or for one package manager (`package_manager_command`), and a token that does not parse (`doc_token`; see {@link generic:doc-syntax}). Notes fail nothing by default; `integration check --strict --next` fails on the ones marked `next`, and the next minor release counts them',
|
|
33
|
+
'The manifest loads, each root holds contributions the CLI can read, and each doc matches its authoring type. Notes list a malformed `cliCommand` (`invalid_cli_command`) and, for each topic, a command written with a package runner (`runner_command`), bare (`plain_command`) or for one package manager (`package_manager_command`), and a token that does not parse (`doc_token`; see {@link generic:doc-syntax}). Two notes, which fail nothing under any flag, say what a catalog needs to list the package: no logo (`package_without_logo`) and no example block (`package_without_example`; see the section below). Notes fail nothing by default; `integration check --strict --next` fails on the ones marked `next`, and the next minor release counts them',
|
|
34
34
|
'A declared root is missing (`missing_root`), a contribution does not load (`invalid_doc`, `invalid_component`, `invalid_theme`), or two templates in the package replace one Core id (`ambiguous_template_replacement`)',
|
|
35
35
|
"The manifest has a key this CLI does not know (`unknown_manifest_key`), or a doc field does not match the doc's authoring type: a field the type does not have, a missing required field, or a value outside the field's type. It also warns on what no reader can serve: a prop listed twice (`duplicate_prop`), a `propDescriptions` key that names no documented prop (`unknown_translated_prop`), a section with no content (`empty_section`), two sections of a topic with one key (`duplicate_section_key`), or a `.doc.zh.mjs` or `.doc.dense.mjs` overlay beside no topic file (`orphan_doc_overlay`). Since 0.7.3 it also lists, from source and without failing, what the package tells apps to import that they cannot: a component's import (the doc's `import`, or the one the CLI derives) or a template's public import whose subpath package.json `exports` does not declare (`component_import_not_exported`, `template_import_not_exported`) or that names another package (`component_import_other_package`); an example that imports an undeclared subpath (`example_import_not_exported`); a template that imports a path outside the templates root (`template_import_outside_root`) or a path its package or Core does not export (`template_private_import`). It lists the same way a component's import whose module does not export the component (`component_import_missing_name`), an example or a template that imports a name its package does not export (`example_import_missing_name`, `template_import_missing_name`), and a template source with no default export (`template_no_default_export`). Each is a note, printed with its fix, that fails `--strict` from the next minor; an import it cannot judge, such as an `exports` target not built yet or a deep path into a `dist/` not built yet, is listed under `publicImports` as not checked. It checks docs with your installed `typescript`, or, where that is missing or has no JavaScript compiler API (TypeScript 7), with an installed `@typescript/typescript6`; without either, it prints `[skip] Docs not type-checked`. With no `astryx.integration.mjs` it prints a hint and exits 0",
|
|
36
36
|
],
|
|
@@ -98,6 +98,27 @@ export const docs = {
|
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
id: 'get-ready-to-list',
|
|
103
|
+
title: 'Get your package ready to list',
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'prose',
|
|
107
|
+
text: 'A catalog that lists your package shows its logo beside its name and previews one of its examples. Two notes in `{@command integration check}` say when either is missing: `package_without_logo` and `package_without_example`. They are information only: they fail no check, with or without `--strict` or `--next`.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'list',
|
|
111
|
+
style: 'ordered',
|
|
112
|
+
items: [
|
|
113
|
+
'Add a square logo inside the package, such as `marketplace/logo.svg`: an SVG drawn only with shapes (no script, style, link, embedded image or outside URL), or a PNG, JPEG or WebP, at most 512 KB. Keep it simple enough to read at 32 pixels.',
|
|
114
|
+
"Put the logo in the integration file, beside `docsiteUrl`, and add a dark-background version if the light one disappears on dark: `logo: {light: './marketplace/logo.svg', dark: './marketplace/logo-dark.svg'}`. Paths are relative to the package root. A logo set in package.json `marketplace.logo` is also read when the integration file has none, but the integration file is the place to set it.",
|
|
115
|
+
'Make sure npm packs it: if package.json has `files`, add `"marketplace"`. `{@command integration verify}` and `{@pm-only npm "it lists exactly what the registry receives" pack --dry-run}` show what ships.',
|
|
116
|
+
'If the package contributes components, add at least one example: a block template that renders a component, with `exampleFor` naming it and `isShowcase: true` in its `.doc.mjs`. Each `component_without_example` note gives the two files to add. A package of themes, docs or codemods alone needs no example: a catalog previews a theme from the theme itself.',
|
|
117
|
+
'Run `{@command integration check}` until neither note is left.',
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
101
122
|
{
|
|
102
123
|
id: 'what-integration-verify-does',
|
|
103
124
|
title: 'Verify the packed package',
|
|
@@ -59,6 +59,7 @@ export const docs = {
|
|
|
59
59
|
items: [
|
|
60
60
|
'List only the roots you ship, and always `astryx.integration.mjs`. npm adds package.json, and a README and LICENSE when you have them.',
|
|
61
61
|
'Each later `integration add` appends its root to the list.',
|
|
62
|
+
'Ship `astryx.integration.mjs`, not `.ts`: the CLI transpiles each `.ts` file it loads on first read per machine, so `.mjs` starts faster. Ship one manifest only; two fail to load. The same holds for doc files and codemods: ship `.mjs`.',
|
|
62
63
|
'`integration verify` fails when a root is missing from the list, and names the root to add to `files` (the message is in {@link generic:troubleshooting}).',
|
|
63
64
|
],
|
|
64
65
|
},
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file `astryx docs styling/tokens-and-setup`: using design tokens in custom
|
|
5
|
-
* styles
|
|
5
|
+
* styles, configuring a StyleX compiler for swizzled components, and keeping
|
|
6
|
+
* Next.js webpack builds small.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
@@ -14,8 +15,16 @@ export const docs = {
|
|
|
14
15
|
placement: {parent: 'namespace:styling', slot: 'guides', order: 30},
|
|
15
16
|
category: 'guide',
|
|
16
17
|
description:
|
|
17
|
-
'Using design tokens in custom styles
|
|
18
|
-
keywords: [
|
|
18
|
+
'Using design tokens in custom styles, configuring a StyleX compiler for swizzled components, and keeping Next.js webpack builds small.',
|
|
19
|
+
keywords: [
|
|
20
|
+
'StyleX setup',
|
|
21
|
+
'swizzle',
|
|
22
|
+
'webpack',
|
|
23
|
+
'Vite',
|
|
24
|
+
'Next.js',
|
|
25
|
+
'optimizePackageImports',
|
|
26
|
+
'Server Components',
|
|
27
|
+
],
|
|
19
28
|
|
|
20
29
|
sections: [
|
|
21
30
|
{
|
|
@@ -129,5 +138,32 @@ export default stylexPlugin({
|
|
|
129
138
|
},
|
|
130
139
|
],
|
|
131
140
|
},
|
|
141
|
+
{
|
|
142
|
+
id: 'nextjs-webpack',
|
|
143
|
+
title: 'Next.js with webpack',
|
|
144
|
+
content: [
|
|
145
|
+
{
|
|
146
|
+
type: 'prose',
|
|
147
|
+
text: 'If your Next.js app builds with webpack (`next build --webpack`), add `@astryxdesign/core` to `experimental.optimizePackageImports`. With webpack, a Server Component that imports from the package root would otherwise ship every client component; this keeps first load to what the page uses. Turbopack, the default bundler in Next.js 16, needs no change, and the setting is safe to keep there.',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'code',
|
|
151
|
+
lang: 'js',
|
|
152
|
+
label: 'next.config.mjs',
|
|
153
|
+
code: `/** @type {import('next').NextConfig} */
|
|
154
|
+
const nextConfig = {
|
|
155
|
+
experimental: {
|
|
156
|
+
optimizePackageImports: ['@astryxdesign/core'],
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export default nextConfig;`,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'prose',
|
|
164
|
+
text: "In Server Components, also import each component from its own entry, for example `import {Button} from '@astryxdesign/core/Button'`. `{@command component <Name>}` prints that entry. Files that start with `'use client'` are not affected.",
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
132
168
|
],
|
|
133
169
|
};
|