@astryxdesign/cli 0.7.0-canary.450c68d → 0.7.0-canary.4ec1f4e

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.
Files changed (168) hide show
  1. package/README.md +30 -33
  2. package/api/doctor/doctor.doc.mjs +1 -1
  3. package/api/doctor/doctor.test.mjs +28 -0
  4. package/api/doctor/theme-checks.mjs +10 -10
  5. package/api/doctor/theme-checks.test.mjs +5 -4
  6. package/api/gap-report/gap-report.doc.mjs +1 -1
  7. package/api/gap-report/gap-report.mjs +15 -0
  8. package/api/gap-report/gap-report.test.mjs +1 -1
  9. package/api/index.d.mts +0 -2
  10. package/api/index.mjs +0 -2
  11. package/api/init/init.doc.mjs +5 -1
  12. package/api/init/init.mjs +22 -0
  13. package/api/init/init.type.d.mts +4 -1
  14. package/api/init/init.type.mjs +1 -1
  15. package/api/init/remove/remove.mjs +8 -3
  16. package/api/init/remove/remove.test.mjs +12 -0
  17. package/api/init/run/run.d.mts +1 -1
  18. package/api/init/run/run.mjs +3 -3
  19. package/api/integration/validate-integration.d.mts +4 -0
  20. package/api/integration/validate-integration.mjs +5 -2
  21. package/api/integration/validateIntegration.doc.mjs +1 -1
  22. package/api/json/index.ts +0 -1
  23. package/api/search/search.doc.mjs +1 -1
  24. package/api/search/search.mjs +1 -1
  25. package/api/search/search.test.mjs +1 -1
  26. package/api/search/search.type.d.mts +1 -1
  27. package/api/search/search.type.mjs +1 -1
  28. package/api/template/template-integration.test.mjs +37 -100
  29. package/api/template/template.doc.mjs +5 -1
  30. package/api/template/template.mjs +45 -0
  31. package/api/theme/_adapter.mjs +3 -3
  32. package/api/theme/add/add.d.mts +11 -5
  33. package/api/theme/add/add.mjs +19 -192
  34. package/api/theme/add/add.test.mjs +68 -258
  35. package/api/theme/add/add.types.test.mjs +0 -1
  36. package/api/theme/build/build.d.mts +3 -3
  37. package/api/theme/build/build.mjs +22 -36
  38. package/api/theme/build/build.test.mjs +11 -24
  39. package/api/theme/eject/eject.copy-compat.test.mjs +168 -0
  40. package/api/theme/integration-themes.test.mjs +3 -3
  41. package/api/theme/remove/remove.test.mjs +1 -1
  42. package/api/theme/targets/targets.test.mjs +0 -4
  43. package/api/theme/template/template.mjs +1 -1
  44. package/api/theme/theme.type.d.mts +1 -30
  45. package/api/theme/theme.type.mjs +3 -13
  46. package/api/theme/themeAdd.doc.mjs +19 -27
  47. package/api/theme/themeTargets.doc.mjs +3 -4
  48. package/api/theme/themeTemplate.doc.mjs +1 -1
  49. package/api/theme/use/use.test.mjs +1 -1
  50. package/api/upgrade/upgrade.doc.mjs +1 -1
  51. package/api/upgrade/upgrade.mjs +19 -0
  52. package/assets/codemods/transforms/next/README.md +15 -17
  53. package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
  54. package/assets/codemods/transforms/next/index.mjs +11 -1
  55. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
  56. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
  57. package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
  58. package/assets/docs/author-a-theme.doc.mjs +1 -1
  59. package/assets/docs/getting-started.doc.mjs +2 -2
  60. package/assets/docs/theme.doc.dense.mjs +1 -1
  61. package/assets/docs/theme.doc.mjs +2 -2
  62. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  63. package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
  64. package/assets/docs/tree/fonts-and-assets.doc.mjs +3 -3
  65. package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
  66. package/assets/docs/tree/themes.doc.mjs +1 -1
  67. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +2 -2
  68. package/assets/docs/tree/versioning.doc.mjs +1 -4
  69. package/assets/docs/use-a-theme.doc.mjs +16 -16
  70. package/authoring/debug/type.ts +2 -2
  71. package/authoring/doctypes/base/type.ts +0 -9
  72. package/authoring/integration/integration.doc.mjs +1 -1
  73. package/clients/cli/command-result-coverage.test.mjs +1 -1
  74. package/clients/cli/commands/build-theme.adaptations.test.mjs +4 -0
  75. package/clients/cli/commands/build-theme.ascii-output.test.mjs +35 -8
  76. package/clients/cli/commands/build-theme.mjs +31 -67
  77. package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
  78. package/clients/cli/commands/debug-result-summary.test.mjs +0 -16
  79. package/clients/cli/commands/discover.mjs +2 -1
  80. package/clients/cli/commands/doctor.mjs +5 -2
  81. package/clients/cli/commands/empty-argument.test.mjs +16 -0
  82. package/clients/cli/commands/gap-report.doc.mjs +1 -1
  83. package/clients/cli/commands/gap-report.test.mjs +2 -2
  84. package/clients/cli/commands/init.doc.mjs +4 -4
  85. package/clients/cli/commands/init.flag-help.test.mjs +7 -10
  86. package/clients/cli/commands/init.next-steps.test.mjs +1 -1
  87. package/clients/cli/commands/option-pair-refusals.test.mjs +37 -0
  88. package/clients/cli/commands/search.test.mjs +1 -1
  89. package/clients/cli/commands/swizzle.mjs +4 -1
  90. package/clients/cli/commands/template.doc.mjs +3 -3
  91. package/clients/cli/commands/template.flag-help.test.mjs +18 -11
  92. package/clients/cli/commands/template.mjs +7 -1
  93. package/clients/cli/commands/text-json-parity.test.mjs +0 -17
  94. package/clients/cli/commands/theme-add-lifecycle.test.mjs +142 -49
  95. package/clients/cli/commands/theme-add.doc.mjs +10 -17
  96. package/clients/cli/commands/theme-list.behavior.test.mjs +2 -1
  97. package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
  98. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  99. package/clients/cli/commands/theme.doc.mjs +2 -2
  100. package/clients/cli/commands/upgrade.doc.mjs +1 -1
  101. package/clients/cli/commands/upgrade.flag-help.test.mjs +7 -11
  102. package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +67 -0
  103. package/clients/cli/index.mjs +0 -4
  104. package/clients/cli/lib/cli-error.mjs +19 -0
  105. package/clients/cli/lib/component-format.mjs +111 -57
  106. package/clients/cli/lib/component-format.test.mjs +28 -39
  107. package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
  108. package/clients/cli/lib/exit-codes.test.mjs +0 -7
  109. package/clients/cli/lib/json-shim.test.mjs +0 -24
  110. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  111. package/foundation/agent-docs/agent-docs.mjs +6 -1
  112. package/foundation/agent-docs/app-theme-workflow.test.mjs +3 -0
  113. package/foundation/config/theme-state.mjs +3 -3
  114. package/foundation/debug/debug-fields.test.mjs +13 -35
  115. package/foundation/debug/event.mjs +13 -78
  116. package/foundation/debug/privacy-contract.test.mjs +20 -12
  117. package/foundation/debug/redact.d.mts +2 -2
  118. package/foundation/debug/redact.mjs +2 -2
  119. package/foundation/discovery/theme-imports.mjs +1 -1
  120. package/foundation/discovery/theming-targets.d.mts +1 -20
  121. package/foundation/discovery/theming-targets.mjs +1 -38
  122. package/foundation/discovery/theming-targets.test.mjs +9 -175
  123. package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
  124. package/foundation/response/error-codes.doc.mjs +1 -1
  125. package/foundation/response/response-types.doc.mjs +11 -30
  126. package/foundation/response/response-types.doc.test.mjs +36 -14
  127. package/foundation/response/response.doc.mjs +1 -1
  128. package/foundation/xle/browser.d.mts +2 -2
  129. package/foundation/xle/browser.mjs +2 -2
  130. package/foundation/xle/expand.mjs +1 -1
  131. package/foundation/xle/print.mjs +1 -1
  132. package/package.json +9 -9
  133. package/api/layout/_adapter.d.mts +0 -34
  134. package/api/layout/_adapter.mjs +0 -148
  135. package/api/layout/check/check.d.mts +0 -17
  136. package/api/layout/check/check.mjs +0 -41
  137. package/api/layout/expand/expand.d.mts +0 -23
  138. package/api/layout/expand/expand.mjs +0 -161
  139. package/api/layout/expand/expand.path-safety.test.mjs +0 -53
  140. package/api/layout/expand/expand.receipt.test.mjs +0 -74
  141. package/api/layout/grammar/grammar.d.mts +0 -14
  142. package/api/layout/grammar/grammar.mjs +0 -88
  143. package/api/layout/layout.d.mts +0 -6
  144. package/api/layout/layout.mjs +0 -17
  145. package/api/layout/layout.test.mjs +0 -297
  146. package/api/layout/layout.type.d.mts +0 -90
  147. package/api/layout/layout.type.mjs +0 -104
  148. package/api/layout/layoutCheck.doc.d.mts +0 -11
  149. package/api/layout/layoutCheck.doc.mjs +0 -85
  150. package/api/layout/layoutExpand.doc.d.mts +0 -11
  151. package/api/layout/layoutExpand.doc.mjs +0 -107
  152. package/api/layout/layoutGrammar.doc.d.mts +0 -11
  153. package/api/layout/layoutGrammar.doc.mjs +0 -57
  154. package/api/theme/add/add.binary.test.mjs +0 -157
  155. package/api/theme/add/add.rollback.test.mjs +0 -158
  156. package/api/theme/add/add.staging.test.mjs +0 -83
  157. package/clients/cli/commands/layout-check.doc.mjs +0 -67
  158. package/clients/cli/commands/layout-expand.doc.mjs +0 -87
  159. package/clients/cli/commands/layout-grammar.doc.mjs +0 -32
  160. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +0 -140
  161. package/clients/cli/commands/layout.doc.mjs +0 -36
  162. package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
  163. package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
  164. package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
  165. package/clients/cli/commands/layout.mjs +0 -327
  166. package/clients/cli/commands/layout.path-help.test.mjs +0 -33
  167. package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
  168. package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
@@ -0,0 +1,322 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import jscodeshift from 'jscodeshift';
5
+ import manifest from '../index.mjs';
6
+ import transform, {
7
+ DEPRECATED_THEME_TARGETS,
8
+ } from '../migrate-deprecated-theme-surface.mjs';
9
+
10
+ const j = jscodeshift.withParser('tsx');
11
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
12
+
13
+ const IMPORT = "import {defineTheme} from '@astryxdesign/core/theme';\n";
14
+
15
+ function apply(source, filePath = 'theme.ts') {
16
+ return transform({source, path: filePath}, api) ?? source;
17
+ }
18
+
19
+ const EXPECTED_TARGETS = {
20
+ 'base-table': 'table',
21
+ checkbox: 'checkbox-indicator',
22
+ codeblock: 'code-block',
23
+ 'codeblock-copy-button': 'code-block-copy-button',
24
+ 'codeblock-header': 'code-block-header',
25
+ 'codeblock-title': 'code-block-title',
26
+ 'date-input-clear-icon': 'input-clear-icon',
27
+ 'date-range-input-clear-icon': 'input-clear-icon',
28
+ hovercard: 'hover-card',
29
+ 'multi-selector-clear-icon': 'input-clear-icon',
30
+ navicon: 'nav-icon',
31
+ 'popover-surface': 'popover',
32
+ progressbar: 'progress-bar',
33
+ 'progressbar-fill': 'progress-bar-fill',
34
+ 'progressbar-mark': 'progress-bar-mark',
35
+ 'progressbar-track': 'progress-bar-track',
36
+ radio: 'radio-indicator',
37
+ 'radio-dot': 'radio-indicator-dot',
38
+ 'selector-clear-icon': 'input-clear-icon',
39
+ statusdot: 'status-dot',
40
+ textarea: 'text-area',
41
+ };
42
+
43
+ describe('migrate-deprecated-theme-surface', () => {
44
+ it('is staged as a required next-release code codemod', () => {
45
+ const entry = manifest.find(
46
+ candidate => candidate.name === 'migrate-deprecated-theme-surface',
47
+ );
48
+ expect(entry).toBeDefined();
49
+ expect(entry?.optional).not.toBe(true);
50
+ expect(entry?.meta.fileExtensions).toContain('.css');
51
+ expect(entry?.meta.fileExtensions).toContain('.ts');
52
+ });
53
+
54
+ it('owns the complete approved 21-target mapping', () => {
55
+ expect(DEPRECATED_THEME_TARGETS).toEqual(EXPECTED_TARGETS);
56
+ expect(Object.keys(DEPRECATED_THEME_TARGETS)).toHaveLength(21);
57
+ });
58
+
59
+ it.each(Object.entries(EXPECTED_TARGETS))(
60
+ 'renames static target key %s to %s inside a components map',
61
+ (oldKey, newKey) => {
62
+ const output = apply(
63
+ `export default {name: 'brand', components: {${JSON.stringify(oldKey)}: {base: {color: 'red'}}}};`,
64
+ );
65
+
66
+ expect(output).not.toContain(`${JSON.stringify(oldKey)}:`);
67
+ expect(output).toContain(`'${newKey}':`);
68
+ },
69
+ );
70
+
71
+ it('renames root, mode, and adaptation component maps', () => {
72
+ const output = apply(`${IMPORT}const theme = defineTheme({
73
+ components: {progressbar: {base: {color: 'red'}}},
74
+ onDark: {components: {'statusdot': {base: {color: 'white'}}}},
75
+ adaptations: {rules: [{value: {components: {'popover-surface': {base: {padding: 8}}}}}]},
76
+ });`);
77
+
78
+ expect(output).toContain("'progress-bar':");
79
+ expect(output).toContain("'status-dot':");
80
+ expect(output).toContain("'popover':");
81
+ expect(output).not.toMatch(/(?:progressbar|statusdot|popover-surface)\s*:/);
82
+ });
83
+
84
+ it('renames a statically declared components variable used by defineTheme', () => {
85
+ const output =
86
+ apply(`${IMPORT}const components = {textarea: {base: {color: 'red'}}};
87
+ export const theme = defineTheme({name: 'brand', components});`);
88
+ expect(output).toContain("'text-area':");
89
+ });
90
+
91
+ it('does not rewrite an unrelated object property named components', () => {
92
+ const input = `const registry = {components: {checkbox: Checkbox}};`;
93
+ expect(apply(input)).toBe(input);
94
+ });
95
+
96
+ it('does not rewrite a default-exported application component registry', () => {
97
+ for (const input of [
98
+ `export default {components: {checkbox: Checkbox, textarea: TextArea}};`,
99
+ `export default {name: 'app', components: {checkbox: Checkbox}};`,
100
+ `const theme = {components: {checkbox: {base: {color: 'red'}}}};`,
101
+ ]) {
102
+ expect(apply(input)).toBe(input);
103
+ }
104
+ });
105
+
106
+ it('does not treat a defineTheme from another library as an Astryx theme', () => {
107
+ const input = `import {defineTheme} from 'other-ui';
108
+ export default defineTheme({components: {checkbox: {base: {color: 'red'}}}});`;
109
+ expect(apply(input)).toBe(input);
110
+ });
111
+
112
+ it.each([
113
+ [
114
+ 'an aliased defineTheme import',
115
+ `import {defineTheme as makeTheme} from '@astryxdesign/core';
116
+ export default makeTheme({name: 'brand', components: {navicon: {base: {}}}});`,
117
+ ],
118
+ [
119
+ 'a namespace defineTheme call',
120
+ `import * as astryx from '@astryxdesign/core/theme';
121
+ export default astryx.defineTheme({components: {navicon: {base: {}}}});`,
122
+ ],
123
+ [
124
+ 'a satisfies-typed theme object',
125
+ `import type {DefineThemeInput} from '@astryxdesign/core';
126
+ export default {components: {navicon: {base: {}}}} satisfies DefineThemeInput;`,
127
+ ],
128
+ [
129
+ 'an as-typed theme object',
130
+ `import type {DefineThemeInput} from '@astryxdesign/core';
131
+ export default ({components: {navicon: {base: {}}}}) as DefineThemeInput;`,
132
+ ],
133
+ [
134
+ 'an annotated theme variable',
135
+ `import type {DefineThemeInput} from '@astryxdesign/core';
136
+ const brand: DefineThemeInput = {name: 'brand', components: {navicon: {base: {}}}};`,
137
+ ],
138
+ ])('recognizes %s', (_name, input) => {
139
+ const output = apply(input);
140
+ expect(output).toContain("'nav-icon':");
141
+ expect(output).not.toMatch(/navicon\s*:/);
142
+ });
143
+
144
+ it('renames a clear-icon alias with a TODO naming the owner scope it loses', () => {
145
+ const output = apply(
146
+ `export default {name: 'brand', components: {'selector-clear-icon': {base: {color: 'red'}}}};`,
147
+ );
148
+ expect(output).toContain("'input-clear-icon':");
149
+ expect(output).toContain(
150
+ 'TODO(astryx upgrade): `selector-clear-icon` became `input-clear-icon`',
151
+ );
152
+ expect(output).toContain(
153
+ '.astryx-input-clear-icon:where(.astryx-selector *)',
154
+ );
155
+ });
156
+
157
+ it('flags two clear-icon aliases that collapse onto the shared target', () => {
158
+ const output = apply(`export default {name: 'brand', components: {
159
+ 'selector-clear-icon': {base: {color: 'red'}},
160
+ 'date-input-clear-icon': {base: {color: 'blue'}},
161
+ }};`);
162
+ expect(output).toContain("'input-clear-icon':");
163
+ expect(output).toContain(
164
+ 'merge deprecated theme target `date-input-clear-icon` into `input-clear-icon`',
165
+ );
166
+ expect(output).toContain("'date-input-clear-icon':");
167
+ });
168
+
169
+ it('uses lexical scope when a theme components variable shadows a registry', () => {
170
+ const input = `${IMPORT}const components = {checkbox: Checkbox};
171
+ function makeTheme() {
172
+ const components = {textarea: {base: {color: 'red'}}};
173
+ return defineTheme({components});
174
+ }`;
175
+ const output = apply(input);
176
+ expect(output).toContain('const components = {checkbox: Checkbox};');
177
+ expect(output).toContain("'text-area':");
178
+ });
179
+
180
+ it('does not rename matching keys outside a components map or dynamic keys', () => {
181
+ const input = `const labels = {progressbar: 'Progress'};
182
+ const oldTarget = 'progressbar';
183
+ const theme = {name: 'brand', components: {[oldTarget]: {base: {color: 'red'}}}};`;
184
+ expect(apply(input)).toBe(input);
185
+ });
186
+
187
+ it('flags a static old/new collision instead of silently dropping either rule', () => {
188
+ const input = `${IMPORT}const theme = defineTheme({name: 'brand', components: {
189
+ progressbar: {base: {color: 'red'}},
190
+ 'progress-bar': {base: {backgroundColor: 'blue'}},
191
+ }});`;
192
+ const output = apply(input);
193
+ expect(output).toContain('TODO(astryx upgrade)');
194
+ expect(output).toContain('merge deprecated theme target `progressbar`');
195
+ expect(output).toContain('progressbar:');
196
+ expect(output).toContain("'progress-bar':");
197
+ expect(apply(output)).toBe(output);
198
+ });
199
+
200
+ it('renames every removed target class in CSS selectors', () => {
201
+ const input = Object.keys(EXPECTED_TARGETS)
202
+ .map(key => `.astryx-${key} { color: red; }`)
203
+ .join('\n');
204
+ const output = apply(input, 'theme.css');
205
+
206
+ for (const [oldKey, newKey] of Object.entries(EXPECTED_TARGETS)) {
207
+ expect(output).not.toMatch(
208
+ new RegExp(
209
+ `\\.astryx-${oldKey.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&')}(?![a-z0-9-])`,
210
+ ),
211
+ );
212
+ expect(output).toContain(`.astryx-${newKey}`);
213
+ }
214
+ });
215
+
216
+ it('replaces target-qualified bare classes with reflected data selectors', () => {
217
+ const output = apply(
218
+ `.astryx-button.primary.sm:hover { color: red; }
219
+ .astryx-heading.level-2 { margin: 0; }
220
+ .astryx-switch.checked { opacity: 1; }
221
+ .astryx-grid.center { place-content: center; }`,
222
+ 'theme.css',
223
+ );
224
+
225
+ expect(output).toContain(
226
+ '.astryx-button:is([data-variant="primary"]):is([data-size="sm"]):hover',
227
+ );
228
+ expect(output).toContain('.astryx-heading:is([data-level="2"])');
229
+ expect(output).toContain('.astryx-switch:is([data-checked="checked"])');
230
+ expect(output).toContain(
231
+ '.astryx-grid:is([data-align="center"],[data-justify="center"])',
232
+ );
233
+ expect(output).not.toMatch(
234
+ /\.(?:primary|sm|level-2|checked|center)(?![a-z0-9_-])/,
235
+ );
236
+ });
237
+
238
+ it('canonicalizes aliases before emitting data-attribute selectors', () => {
239
+ const output = apply(
240
+ '.astryx-progressbar.success > .astryx-progressbar-mark.fill {}',
241
+ 'theme.css',
242
+ );
243
+ expect(output).toContain(
244
+ '.astryx-progress-bar:is([data-variant="success"])',
245
+ );
246
+ expect(output).toContain(
247
+ '.astryx-progress-bar-mark:is([data-placement="fill"])',
248
+ );
249
+ expect(output).not.toContain('astryx-progressbar');
250
+ expect(output).not.toMatch(/\.(?:success|fill)(?![a-z0-9_-])/);
251
+ });
252
+
253
+ it('finishes selectors produced by the 0.6 compatibility codemod', () => {
254
+ const output = apply(
255
+ '.astryx-button:is(.primary,[data-variant="primary"]) {}',
256
+ 'theme.css',
257
+ );
258
+ expect(output).toContain('.astryx-button:is([data-variant="primary"])');
259
+ expect(output).not.toContain('.primary');
260
+ });
261
+
262
+ it('keeps the owner scope of clear-icon aliases in CSS without adding specificity', () => {
263
+ const output = apply(
264
+ `.astryx-selector-clear-icon:hover { color: red; }
265
+ .astryx-date-range-input-clear-icon { color: blue; }`,
266
+ 'theme.css',
267
+ );
268
+ expect(output).toContain(
269
+ '.astryx-input-clear-icon:where(.astryx-selector *):hover',
270
+ );
271
+ expect(output).toContain(
272
+ '.astryx-input-clear-icon:where(.astryx-date-range-input *)',
273
+ );
274
+ expect(output).not.toMatch(/-clear-icon(?!:where)/);
275
+ });
276
+
277
+ it('migrates bare classes that first shipped after 0.5.4', () => {
278
+ const output = apply('.astryx-heading.bold { color: red; }', 'theme.css');
279
+ expect(output).toContain('.astryx-heading:is([data-weight="bold"])');
280
+ expect(output).not.toMatch(/\.bold(?![a-z0-9_-])/);
281
+ });
282
+
283
+ it('flags a known bare class that has no 0.6 meaning on its target', () => {
284
+ const input = '.astryx-button.checked { color: red; }';
285
+ const output = apply(input, 'theme.css');
286
+ expect(output).toContain(
287
+ 'TODO(astryx upgrade): Astryx 0.7 no longer emits',
288
+ );
289
+ expect(output).toContain('.checked had no known 0.6 meaning');
290
+ expect(output).toContain('.astryx-button.checked');
291
+ expect(apply(output, 'theme.css')).toBe(output);
292
+ });
293
+
294
+ it('leaves unqualified and unknown consumer classes unchanged', () => {
295
+ const input = `.primary { color: red; }
296
+ .astryx-button.brand { color: blue; }`;
297
+ expect(apply(input, 'theme.css')).toBe(input);
298
+ });
299
+
300
+ it('does not remove a data-selector union from a different selector compound', () => {
301
+ const output = apply(
302
+ '.astryx-button.primary .consumer:is(.primary,[data-custom="x"]) {}',
303
+ 'theme.css',
304
+ );
305
+ expect(output).toContain('.astryx-button:is([data-variant="primary"])');
306
+ expect(output).toContain('.consumer:is(.primary,[data-custom="x"])');
307
+ });
308
+
309
+ it('never rewrites CSS examples in JavaScript strings', () => {
310
+ const input = `const selector = '.astryx-progressbar.success';`;
311
+ expect(apply(input)).toBe(input);
312
+ });
313
+
314
+ it('is byte-idempotent after JavaScript and CSS migration', () => {
315
+ const js = `export default {name: 'brand', components: {statusdot: {base: {color: 'red'}}, 'selector-clear-icon': {base: {color: 'red'}}}};`;
316
+ const css = '.astryx-textarea.sm {}';
317
+ const jsOnce = apply(js);
318
+ const cssOnce = apply(css, 'theme.css');
319
+ expect(apply(jsOnce)).toBe(jsOnce);
320
+ expect(apply(cssOnce, 'theme.css')).toBe(cssOnce);
321
+ });
322
+ });
@@ -7,4 +7,14 @@
7
7
  * this file into the resolved version folder.
8
8
  */
9
9
 
10
- export default [];
10
+ import migrateDeprecatedThemeSurface, {
11
+ meta as migrateDeprecatedThemeSurfaceMeta,
12
+ } from './migrate-deprecated-theme-surface.mjs';
13
+
14
+ export default [
15
+ {
16
+ name: 'migrate-deprecated-theme-surface',
17
+ transform: migrateDeprecatedThemeSurface,
18
+ meta: migrateDeprecatedThemeSurfaceMeta,
19
+ },
20
+ ];