@astryxdesign/cli 0.7.14 → 0.7.15-canary.g061b2fa
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 +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/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 +17 -1
- package/api/theme/_adapter.mjs +185 -40
- package/api/theme/build/build.d.mts +29 -1
- package/api/theme/build/build.mjs +426 -65
- package/api/theme/eject/eject.mjs +10 -6
- 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 +372 -109
- package/api/theme-edit/_check.d.mts +6 -3
- package/api/theme-edit/_check.mjs +665 -87
- package/api/theme-edit/_color.mjs +4 -2
- package/api/theme-edit/_compiler.d.mts +2 -1
- package/api/theme-edit/_compiler.mjs +27 -13
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +47 -8
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +484 -66
- package/api/theme-edit/_how-commands.d.mts +33 -7
- package/api/theme-edit/_how-commands.mjs +57 -45
- package/api/theme-edit/_how-question.d.mts +4 -0
- package/api/theme-edit/_how-question.mjs +1004 -223
- package/api/theme-edit/_how.mjs +96 -9
- package/api/theme-edit/_palette.d.mts +38 -13
- package/api/theme-edit/_palette.mjs +620 -223
- package/api/theme-edit/_parts.mjs +63 -7
- 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 +6 -0
- package/api/theme-edit/_preview-app.mjs +1194 -207
- package/api/theme-edit/_preview.mjs +2 -2
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +37 -6
- package/api/theme-edit/_settings.d.mts +104 -33
- package/api/theme-edit/_settings.mjs +818 -118
- package/api/theme-edit/_tables.d.mts +7 -0
- package/api/theme-edit/_tables.mjs +61 -0
- package/api/theme-edit/theme-edit.type.d.mts +11 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- 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 +1 -1
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -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.generated.json +2 -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/theme.mjs +178 -78
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- 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/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- 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 +374 -42
- package/clients/cli/index.mjs +9 -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/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 +2 -8
- 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 +741 -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/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +11 -2
- package/foundation/release/cache.mjs +59 -10
- package/foundation/release/folder-lock.d.mts +21 -0
- package/foundation/release/folder-lock.mjs +171 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +8 -6
|
@@ -30,6 +30,13 @@ export const TEXT_SIZE: Array<[string, number]>;
|
|
|
30
30
|
* @type {Record<string, [string, string]>}
|
|
31
31
|
*/
|
|
32
32
|
export const FONTS: Record<string, [string, string]>;
|
|
33
|
+
/**
|
|
34
|
+
* Family names that need no font file: CSS generic families and fonts the
|
|
35
|
+
* usual desktop systems ship. Lowercase.
|
|
36
|
+
*/
|
|
37
|
+
export const SYSTEM_FAMILIES: Set<string>;
|
|
38
|
+
/** CSS-wide keywords: never a family, and invalid inside a list. */
|
|
39
|
+
export const CSS_WIDE_KEYWORDS: string[];
|
|
33
40
|
/** Presets every desktop system already has, so no font file is needed. */
|
|
34
41
|
export const SYSTEM_FONTS: string[];
|
|
35
42
|
/**
|
|
@@ -116,6 +116,67 @@ export const FONTS = {
|
|
|
116
116
|
rounded: ['Nunito', '"Varela Round", system-ui, sans-serif'],
|
|
117
117
|
comic: ['Comic Sans MS', '"Comic Neue", cursive'],
|
|
118
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* Family names that need no font file: CSS generic families and fonts the
|
|
121
|
+
* usual desktop systems ship. Lowercase.
|
|
122
|
+
*/
|
|
123
|
+
export const SYSTEM_FAMILIES = new Set([
|
|
124
|
+
'serif',
|
|
125
|
+
'sans-serif',
|
|
126
|
+
'monospace',
|
|
127
|
+
'cursive',
|
|
128
|
+
'fantasy',
|
|
129
|
+
'math',
|
|
130
|
+
'emoji',
|
|
131
|
+
'fangsong',
|
|
132
|
+
'system-ui',
|
|
133
|
+
'ui-serif',
|
|
134
|
+
'ui-sans-serif',
|
|
135
|
+
'ui-monospace',
|
|
136
|
+
'ui-rounded',
|
|
137
|
+
'-apple-system',
|
|
138
|
+
'blinkmacsystemfont',
|
|
139
|
+
'arial',
|
|
140
|
+
'arial black',
|
|
141
|
+
'helvetica',
|
|
142
|
+
'helvetica neue',
|
|
143
|
+
'segoe ui',
|
|
144
|
+
'tahoma',
|
|
145
|
+
'verdana',
|
|
146
|
+
'trebuchet ms',
|
|
147
|
+
'georgia',
|
|
148
|
+
'times',
|
|
149
|
+
'times new roman',
|
|
150
|
+
'palatino',
|
|
151
|
+
'garamond',
|
|
152
|
+
'courier',
|
|
153
|
+
'courier new',
|
|
154
|
+
'consolas',
|
|
155
|
+
'menlo',
|
|
156
|
+
'monaco',
|
|
157
|
+
'sf mono',
|
|
158
|
+
'sf pro',
|
|
159
|
+
'sf pro text',
|
|
160
|
+
'sf pro display',
|
|
161
|
+
'ubuntu',
|
|
162
|
+
'cantarell',
|
|
163
|
+
'noto sans',
|
|
164
|
+
'liberation sans',
|
|
165
|
+
'dejavu sans',
|
|
166
|
+
'comic sans ms',
|
|
167
|
+
'impact',
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
/** CSS-wide keywords: never a family, and invalid inside a list. */
|
|
171
|
+
export const CSS_WIDE_KEYWORDS = [
|
|
172
|
+
'inherit',
|
|
173
|
+
'initial',
|
|
174
|
+
'unset',
|
|
175
|
+
'revert',
|
|
176
|
+
'revert-layer',
|
|
177
|
+
'default',
|
|
178
|
+
];
|
|
179
|
+
|
|
119
180
|
/** Presets every desktop system already has, so no font file is needed. */
|
|
120
181
|
export const SYSTEM_FONTS = [
|
|
121
182
|
'system',
|
|
@@ -115,7 +115,7 @@ export type ThemeEditPreviewFields = {
|
|
|
115
115
|
cause: string;
|
|
116
116
|
} | null;
|
|
117
117
|
/**
|
|
118
|
-
* - Files of the in-app theme preview that were
|
|
118
|
+
* - Files of the in-app theme preview that were not written again and still show the theme as it was: changed by hand, or a preview folder where a stopped preview change waits for the next preview command.
|
|
119
119
|
*/
|
|
120
120
|
previewStale?: string[] | undefined;
|
|
121
121
|
};
|
|
@@ -342,6 +342,8 @@ export type ThemeEditUndoResponse = {
|
|
|
342
342
|
undone: string[];
|
|
343
343
|
settings: number;
|
|
344
344
|
stepsLeft: number;
|
|
345
|
+
changedTokens: string[];
|
|
346
|
+
problems: string[];
|
|
345
347
|
} & ThemeEditPreviewFields;
|
|
346
348
|
};
|
|
347
349
|
export type ThemeEditPreviewAddOptions = {
|
|
@@ -430,6 +432,9 @@ export type ThemeEditPreviewListOptions = {
|
|
|
430
432
|
*/
|
|
431
433
|
export type ThemeEditPreviewListResponse = {
|
|
432
434
|
type: "themeEdit.previewList";
|
|
435
|
+
/**
|
|
436
|
+
* - `notes`: what else to know, such as a theme the preview wears that is gone.
|
|
437
|
+
*/
|
|
433
438
|
data: {
|
|
434
439
|
folder: string | null;
|
|
435
440
|
theme: string | null;
|
|
@@ -437,6 +442,7 @@ export type ThemeEditPreviewListResponse = {
|
|
|
437
442
|
id: string;
|
|
438
443
|
label: string;
|
|
439
444
|
}>;
|
|
445
|
+
notes: string[];
|
|
440
446
|
};
|
|
441
447
|
};
|
|
442
448
|
/**
|
|
@@ -475,6 +481,10 @@ export type ThemeEditHowOptions = {
|
|
|
475
481
|
* - With a PNG picture: how many main colors (default 14).
|
|
476
482
|
*/
|
|
477
483
|
count?: number | undefined;
|
|
484
|
+
/**
|
|
485
|
+
* - The words as typed after `how`: a picture first takes only a count after it (the count is read from the words); anything else is one question. Replaces `subject`.
|
|
486
|
+
*/
|
|
487
|
+
words?: string[] | undefined;
|
|
478
488
|
};
|
|
479
489
|
/**
|
|
480
490
|
* `astryx --json experimental theme editor how <subject>`. `kind` says which answer it is.
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* @property {string[]} pictures - PNG pictures taken (only with `png`).
|
|
52
52
|
* @property {string | null} pictureProblem - Why no picture was taken, and how to get a browser for it.
|
|
53
53
|
* @property {{code: string, cause: string} | null} notChecked - Set when the change is saved but the components could not be rendered, so it was not checked and has no preview: the cause, such as two copies of React.
|
|
54
|
-
* @property {string[]} [previewStale] - Files of the in-app theme preview that were
|
|
54
|
+
* @property {string[]} [previewStale] - Files of the in-app theme preview that were not written again and still show the theme as it was: changed by hand, or a preview folder where a stopped preview change waits for the next preview command.
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
* @experimental May change or be removed in a patch release.
|
|
162
162
|
* @typedef {object} ThemeEditUndoResponse
|
|
163
163
|
* @property {'themeEdit.undo'} type
|
|
164
|
-
* @property {{theme: string, action: 'step', undone: string[], settings: number, stepsLeft: number} & ThemeEditPreviewFields} data
|
|
164
|
+
* @property {{theme: string, action: 'step', undone: string[], settings: number, stepsLeft: number, changedTokens: string[], problems: string[]} & ThemeEditPreviewFields} data
|
|
165
165
|
*/
|
|
166
166
|
|
|
167
167
|
/**
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
* @experimental May change or be removed in a patch release.
|
|
226
226
|
* @typedef {object} ThemeEditPreviewListResponse
|
|
227
227
|
* @property {'themeEdit.previewList'} type
|
|
228
|
-
* @property {{folder: string | null, theme: string | null, pages: Array<{id: string, label: string}
|
|
228
|
+
* @property {{folder: string | null, theme: string | null, pages: Array<{id: string, label: string}>, notes: string[]}} data - `notes`: what else to know, such as a theme the preview wears that is gone.
|
|
229
229
|
*/
|
|
230
230
|
|
|
231
231
|
/**
|
|
@@ -251,6 +251,7 @@
|
|
|
251
251
|
* @property {string} [theme] - The theme the suggested commands are for, checked against its settings (default: the only theme the editor made in the app; with several, the one an editor command changed last; with none, `my-theme`, which the answer makes first). An empty name is refused.
|
|
252
252
|
* @property {string[]} [at] - With a PNG picture: pixel points x,y, whole numbers inside the picture ("40,20;300,180", "40,20 300,180", several entries, or a flat "40,20,300,180").
|
|
253
253
|
* @property {number} [count] - With a PNG picture: how many main colors (default 14).
|
|
254
|
+
* @property {string[]} [words] - The words as typed after `how`: a picture first takes only a count after it (the count is read from the words); anything else is one question. Replaces `subject`.
|
|
254
255
|
*/
|
|
255
256
|
|
|
256
257
|
/**
|
|
@@ -53,6 +53,12 @@ export const doc = {
|
|
|
53
53
|
type: 'number',
|
|
54
54
|
description: 'With a picture: how many main colors (default 14).',
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
name: 'options.words',
|
|
58
|
+
type: 'string[]',
|
|
59
|
+
description:
|
|
60
|
+
'The words as typed: a picture first takes only a count after it; anything else is one question. Replaces the subject.',
|
|
61
|
+
},
|
|
56
62
|
{
|
|
57
63
|
name: 'options.cwd',
|
|
58
64
|
type: 'string',
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
summary:
|
|
14
14
|
'Add pages to the theme preview in the app: the default pages, the best template pages for a description, or one template.',
|
|
15
15
|
description:
|
|
16
|
-
"Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/ or node_modules/, in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no `path` and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.",
|
|
16
|
+
"Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/ or node_modules/, in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no `path` and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. The folder is also refused when it holds a package.json, when another page of the app already serves its URL (a route group or the Pages Router), when next.config sets pageExtensions without tsx, when it is in src/app/ while app/ is what Next serves, and when no root layout is above it (an app with its root layout in [locale]/ gets its preview there, opened at /<locale>/theme-preview; an app with a root layout in each route group takes the preview under any of them). A template's needs come from its real import statements, never words in comments or strings; a package the app does not name gets the command that adds it. A theme with no build is built only after every check passed, holding that theme's lock, with a note. An edit inside a string counts as a change by hand; a formatter run does not. Experimental: it may change or be removed in a patch release.",
|
|
17
17
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
18
18
|
signature:
|
|
19
19
|
'themeEditPreviewAdd(description?: string, options?: object): Promise<object>',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewApp()',
|
|
13
13
|
summary: 'Make a new starter app with the theme preview inside.',
|
|
14
14
|
description:
|
|
15
|
-
"Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/ or node_modules/, or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. Experimental: it may change or be removed in a patch release.",
|
|
15
|
+
"Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/ or node_modules/, or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature:
|
|
18
18
|
'themeEditPreviewApp(dir: string, options?: object): Promise<object>',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewList()',
|
|
13
13
|
summary: 'The pages of the theme preview in the app.',
|
|
14
14
|
description:
|
|
15
|
-
'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. Experimental: it may change or be removed in a patch release.',
|
|
15
|
+
'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. `notes` says when the theme the preview wears is gone. Experimental: it may change or be removed in a patch release.',
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature: 'themeEditPreviewList(options?: object): Promise<object>',
|
|
18
18
|
keywords: ['theme', 'experimental theme', 'preview', 'theme preview'],
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'themeEditPreviewRemove()',
|
|
13
13
|
summary: 'Remove one page from the theme preview, or the whole preview.',
|
|
14
14
|
description:
|
|
15
|
-
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.',
|
|
15
|
+
'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. A remove deletes only the route file, the record and the page files of recorded pages (in _pages/, or pages/ for an older release), and only when a recorded hash shows they are as the preview wrote them: any other file the record names, and any file with no recorded hash, is kept and named, so a copied or edited record never deletes a project file. A route that stays keeps the pages it imports. Experimental: it may change or be removed in a patch release.',
|
|
16
16
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
17
17
|
signature:
|
|
18
18
|
'themeEditPreviewRemove(page?: string, options?: object): Promise<object>',
|
|
@@ -76,6 +76,10 @@ export const doc = {
|
|
|
76
76
|
code: 'ERR_THEME_LOAD',
|
|
77
77
|
when: 'the theme the route wears has no build and does not build; nothing is deleted',
|
|
78
78
|
},
|
|
79
|
+
{
|
|
80
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
81
|
+
when: 'a second page or another extra argument on the command line',
|
|
82
|
+
},
|
|
79
83
|
{
|
|
80
84
|
code: 'ERR_PROJECT_REQUIRED',
|
|
81
85
|
when: 'no package.json in the folder or above it',
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
summary:
|
|
14
14
|
'Put the theme back as it was before its last change, or remove one setting.',
|
|
15
15
|
description:
|
|
16
|
-
'With only the theme, it steps back one change: the settings
|
|
16
|
+
'With only the theme, it steps back one change: the settings, the generated settings module and the build go back to how they were before the last change (your <theme>.theme.ts is not touched), and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With `thing`, it removes that one setting instead, wherever it is in the settings, and the `now` field of the result says what applies instead (a dial that still writes it, a whole-theme setting of the same thing, or the value of the base theme); name it the way it was set, with the same `on`, `when`, `state`, `mode` and `only`. Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. `undo <theme> base` and `undo <theme> mode` go back to the base and mode the theme was made with; when they never changed, that is refused. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Experimental: it may change or be removed in a patch release.',
|
|
17
17
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
18
18
|
signature: 'themeEditUndo(theme: string, options?: object): Promise<object>',
|
|
19
19
|
keywords: [
|
|
@@ -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',
|