bestax-migrate 2.1.6 → 2.2.0

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 (61) hide show
  1. package/README.md +13 -8
  2. package/dist/cli.d.ts +53 -0
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +159 -9
  5. package/dist/sources/_shared/imports.d.ts +46 -0
  6. package/dist/sources/_shared/imports.d.ts.map +1 -0
  7. package/dist/sources/_shared/imports.js +152 -0
  8. package/dist/sources/{react-bulma-components → _shared}/jsx-utils.d.ts +20 -12
  9. package/dist/sources/_shared/jsx-utils.d.ts.map +1 -0
  10. package/dist/sources/{react-bulma-components → _shared}/jsx-utils.js +15 -10
  11. package/dist/sources/_shared/make-styles-transform.d.ts +37 -0
  12. package/dist/sources/_shared/make-styles-transform.d.ts.map +1 -0
  13. package/dist/sources/_shared/make-styles-transform.js +440 -0
  14. package/dist/sources/_shared/props.d.ts +20 -0
  15. package/dist/sources/_shared/props.d.ts.map +1 -0
  16. package/dist/sources/{react-bulma-components → _shared}/props.js +11 -7
  17. package/dist/sources/_shared/specials-utils.d.ts +45 -0
  18. package/dist/sources/_shared/specials-utils.d.ts.map +1 -0
  19. package/dist/sources/_shared/specials-utils.js +124 -0
  20. package/dist/sources/rbx/deps.d.ts +18 -0
  21. package/dist/sources/rbx/deps.d.ts.map +1 -0
  22. package/dist/sources/rbx/deps.js +287 -0
  23. package/dist/sources/rbx/index.d.ts +3 -0
  24. package/dist/sources/rbx/index.d.ts.map +1 -0
  25. package/dist/sources/rbx/index.js +10 -0
  26. package/dist/sources/rbx/mapping.d.ts +49 -0
  27. package/dist/sources/rbx/mapping.d.ts.map +1 -0
  28. package/dist/sources/rbx/mapping.js +924 -0
  29. package/dist/sources/rbx/responsive.d.ts +30 -0
  30. package/dist/sources/rbx/responsive.d.ts.map +1 -0
  31. package/dist/sources/rbx/responsive.js +279 -0
  32. package/dist/sources/rbx/specials.d.ts +21 -0
  33. package/dist/sources/rbx/specials.d.ts.map +1 -0
  34. package/dist/sources/rbx/specials.js +706 -0
  35. package/dist/sources/rbx/styles.d.ts +21 -0
  36. package/dist/sources/rbx/styles.d.ts.map +1 -0
  37. package/dist/sources/rbx/styles.js +29 -0
  38. package/dist/sources/rbx/transform.d.ts +25 -0
  39. package/dist/sources/rbx/transform.d.ts.map +1 -0
  40. package/dist/sources/rbx/transform.js +911 -0
  41. package/dist/sources/react-bulma-components/deps.d.ts.map +1 -1
  42. package/dist/sources/react-bulma-components/deps.js +16 -0
  43. package/dist/sources/react-bulma-components/responsive.d.ts +1 -1
  44. package/dist/sources/react-bulma-components/responsive.d.ts.map +1 -1
  45. package/dist/sources/react-bulma-components/responsive.js +1 -1
  46. package/dist/sources/react-bulma-components/specials.d.ts +3 -9
  47. package/dist/sources/react-bulma-components/specials.d.ts.map +1 -1
  48. package/dist/sources/react-bulma-components/specials.js +4 -91
  49. package/dist/sources/react-bulma-components/styles.d.ts +9 -9
  50. package/dist/sources/react-bulma-components/styles.d.ts.map +1 -1
  51. package/dist/sources/react-bulma-components/styles.js +17 -389
  52. package/dist/sources/react-bulma-components/transform.d.ts.map +1 -1
  53. package/dist/sources/react-bulma-components/transform.js +378 -101
  54. package/dist/sources/registry.d.ts.map +1 -1
  55. package/dist/sources/registry.js +2 -0
  56. package/dist/types.d.ts +8 -0
  57. package/dist/types.d.ts.map +1 -1
  58. package/package.json +8 -7
  59. package/dist/sources/react-bulma-components/jsx-utils.d.ts.map +0 -1
  60. package/dist/sources/react-bulma-components/props.d.ts +0 -15
  61. package/dist/sources/react-bulma-components/props.d.ts.map +0 -1
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Building blocks shared by every source's structural handlers: picking a
3
+ * target from an align-style prop, stripping Bulma modifier props off an
4
+ * element on its way to becoming plain HTML, merging a consumed `className`,
5
+ * and reading an icon-font class string.
6
+ *
7
+ * Source-agnostic. `makeStripModifierProps` is a factory precisely because
8
+ * the modifier vocabulary is the one thing here that differs per source.
9
+ */
10
+ import { addTodo, findAttr, literalValueOf, removeAttr, } from './jsx-utils.js';
11
+ /** Pick a target based on a literal align-style prop, removing the prop. */
12
+ export function alignTarget(ctx, path, element, prop, targets, fallback) {
13
+ const attr = findAttr(element, prop);
14
+ if (!attr)
15
+ return { target: fallback };
16
+ const literal = literalValueOf(attr);
17
+ if (literal.kind === 'string' && targets[literal.value]) {
18
+ removeAttr(element, attr);
19
+ ctx.dirty = true;
20
+ return { target: targets[literal.value] };
21
+ }
22
+ if (literal.kind === 'string') {
23
+ removeAttr(element, attr);
24
+ ctx.dirty = true;
25
+ return { target: fallback };
26
+ }
27
+ addTodo(ctx, path, `prop:${prop}`, `\`${prop}\` has a dynamic value; pick between ${Object.values(targets).join(' / ')} by hand`);
28
+ removeAttr(element, attr);
29
+ ctx.dirty = true;
30
+ return { target: fallback };
31
+ }
32
+ /**
33
+ * Build the modifier-prop filter for one source: it needs that source's own
34
+ * universal-prop and breakpoint tables to know what counts as a modifier.
35
+ *
36
+ * The returned function filters Bulma modifier props out of an attribute list
37
+ * bound for a plain HTML element (they only exist on bestax components),
38
+ * leaving a TODO when any were dropped.
39
+ */
40
+ export function makeStripModifierProps(universalProps, responsiveBreakpoints) {
41
+ return function stripModifierProps(ctx, path, attrs, where) {
42
+ const kept = [];
43
+ const dropped = [];
44
+ for (const attr of attrs) {
45
+ const name = attr?.name?.name;
46
+ if (name && (universalProps[name] || name in responsiveBreakpoints)) {
47
+ dropped.push(name);
48
+ }
49
+ else {
50
+ kept.push(attr);
51
+ }
52
+ }
53
+ if (dropped.length > 0) {
54
+ addTodo(ctx, path, 'plain-element', `${where} became a plain element; the Bulma helper prop(s) ${dropped
55
+ .map(d => `\`${d}\``)
56
+ .join(', ')} were dropped — restyle with classes`);
57
+ }
58
+ return kept;
59
+ };
60
+ }
61
+ /**
62
+ * Consume the element's `className` so a plain-element rewrite can merge it
63
+ * with its hard-coded Bulma class instead of dropping it. A dynamic value
64
+ * can't be merged safely — keep the base class and leave a TODO.
65
+ */
66
+ export function mergeClassName(ctx, path, element, base, where) {
67
+ const attr = findAttr(element, 'className');
68
+ if (!attr)
69
+ return base;
70
+ const literal = literalValueOf(attr);
71
+ removeAttr(element, attr);
72
+ if (literal.kind === 'string') {
73
+ return base ? `${base} ${literal.value}` : literal.value;
74
+ }
75
+ addTodo(ctx, path, 'prop:className', base
76
+ ? `dynamic ${where} className; merge it with the \`${base}\` class by hand`
77
+ : `dynamic ${where} className; re-apply it to the emitted element by hand`);
78
+ return base;
79
+ }
80
+ /** Parse an icon-font <i className="..."> into bestax Icon name/library/variant. */
81
+ export function parseIconClasses(className) {
82
+ const tokens = className.trim().split(/\s+/);
83
+ const faVariant = {
84
+ fas: 'solid',
85
+ far: 'regular',
86
+ fab: 'brands',
87
+ fal: 'light',
88
+ fad: 'duotone',
89
+ fat: 'thin',
90
+ // Font Awesome 6 spells the style out, and has been the default since
91
+ // 2022 — matching only the v5 short forms meant the common case fell
92
+ // through to the "migrate this icon by hand" TODO.
93
+ 'fa-solid': 'solid',
94
+ 'fa-regular': 'regular',
95
+ 'fa-brands': 'brands',
96
+ 'fa-light': 'light',
97
+ 'fa-duotone': 'duotone',
98
+ 'fa-thin': 'thin',
99
+ };
100
+ const faStyle = tokens.find(t => faVariant[t]);
101
+ // Every `fa-*` that is a MODIFIER rather than an icon name — including
102
+ // v6's spelled-out style and family words, which are `fa-` prefixed and
103
+ // would otherwise be read as the icon (`fa-solid fa-home` → name="solid").
104
+ // The old list
105
+ // covered only sizing and spin, so a class string that puts a modifier
106
+ // first — `fas fa-rotate-90 fa-home`, which Font Awesome's own docs show —
107
+ // yielded name="rotate-90". Ordering is not guaranteed, so the filter has
108
+ // to be exhaustive rather than positional.
109
+ const FA_MODIFIER = /^fa-(?:solid|regular|brands|light|duotone|thin|sharp|classic|2xs|xs|sm|lg|xl|2xl|\d{1,2}x|fw|ul|li|border|inverse|stack|stack-1x|stack-2x|pull-(?:left|right)|spin|spin-pulse|spin-reverse|pulse|beat|fade|beat-fade|bounce|flash|shake|swap-opacity|rotate-(?:90|180|270|by)|flip-(?:horizontal|vertical|both))$/;
110
+ const faName = tokens.find(t => /^fa-/.test(t) && !FA_MODIFIER.test(t));
111
+ if (faStyle && faName) {
112
+ return {
113
+ name: faName.replace(/^fa-/, ''),
114
+ library: 'fa',
115
+ variant: faVariant[faStyle],
116
+ };
117
+ }
118
+ if (tokens.includes('mdi')) {
119
+ const mdiName = tokens.find(t => /^mdi-/.test(t) && t !== 'mdi');
120
+ if (mdiName)
121
+ return { name: mdiName.replace(/^mdi-/, ''), library: 'mdi' };
122
+ }
123
+ return null;
124
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * package.json migration: swap rbx for @allxsmith/bestax-bulma and clear out
3
+ * the stylesheet dependencies rbx dragged in with it. Pure data-in/data-out —
4
+ * the CLI owns file IO, and no package manager is ever invoked (the report
5
+ * tells the user to install).
6
+ *
7
+ * This is the step with the biggest visible payoff for an rbx app. Unlike
8
+ * react-bulma-components, which peer-depends on Bulma and lets the app pick a
9
+ * version, rbx ships `bulma@0.7.5` as a *direct* dependency plus four Bulma
10
+ * extensions — so an rbx app cannot move to Bulma v1 at all while rbx is
11
+ * installed. Removing rbx is what frees that, and the report says so; its
12
+ * four Bulma extensions are reported for the user to remove, not deleted —
13
+ * see the note on that below.
14
+ * says so by name.
15
+ */
16
+ import type { DependenciesUpdate } from '../../types.js';
17
+ export declare const updateDependencies: DependenciesUpdate;
18
+ //# sourceMappingURL=deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAgHzD,eAAO,MAAM,kBAAkB,EAAE,kBAqLhC,CAAC"}
@@ -0,0 +1,287 @@
1
+ /**
2
+ * package.json migration: swap rbx for @allxsmith/bestax-bulma and clear out
3
+ * the stylesheet dependencies rbx dragged in with it. Pure data-in/data-out —
4
+ * the CLI owns file IO, and no package manager is ever invoked (the report
5
+ * tells the user to install).
6
+ *
7
+ * This is the step with the biggest visible payoff for an rbx app. Unlike
8
+ * react-bulma-components, which peer-depends on Bulma and lets the app pick a
9
+ * version, rbx ships `bulma@0.7.5` as a *direct* dependency plus four Bulma
10
+ * extensions — so an rbx app cannot move to Bulma v1 at all while rbx is
11
+ * installed. Removing rbx is what frees that, and the report says so; its
12
+ * four Bulma extensions are reported for the user to remove, not deleted —
13
+ * see the note on that below.
14
+ * says so by name.
15
+ */
16
+ const BESTAX_RANGE = '^5';
17
+ const BULMA_RANGE = '^1.0.4';
18
+ // Bulma v1's sass tree uses `color.channel(…)` — needs dart-sass ≥ 1.79.
19
+ const SASS_RANGE = '^1.79.0';
20
+ /**
21
+ * The Bulma extensions rbx depends on directly. Bulma v1 and bestax cover all
22
+ * four: badge and tooltip became bestax components, the page loader became
23
+ * `Loading`, and the divider became `Divider`.
24
+ */
25
+ const RBX_STYLE_DEPS = [
26
+ 'bulma-badge',
27
+ 'bulma-divider',
28
+ 'bulma-pageloader',
29
+ 'bulma-tooltip',
30
+ ];
31
+ const DEP_SECTIONS = ['dependencies', 'devDependencies'];
32
+ /**
33
+ * True only when `range` PROVABLY admits no version >= 1.0.0.
34
+ *
35
+ * The first version matched a leading `0` and nothing else, so a range written
36
+ * as comparators (`>=0.7 <1`) was left on 0.x and then reported as already v1.
37
+ * This walks each `||` alternative and its comparators: a set is pre-v1 when
38
+ * some comparator caps it below 1.0.0 and none of them opens it at 1 or above.
39
+ *
40
+ * Conservative by design: an unrecognised shape returns false and the range is
41
+ * left alone (and reported as such). Bumping a range that might already admit
42
+ * v1 would be the best-guess rewrite this package refuses to make.
43
+ */
44
+ function isPreV1(range) {
45
+ const alternatives = range.trim().split(/\s*\|\|\s*/);
46
+ return alternatives.length > 0 && alternatives.every(setIsPreV1);
47
+ }
48
+ function setIsPreV1(set) {
49
+ // npm accepts whitespace between an operator and its version
50
+ // (`>= 0.7.0 < 1.0.0`); splitting on whitespace first made the operator a
51
+ // token of its own, so the range parsed as unrecognised and was left alone.
52
+ const text = glueOperators(set);
53
+ if (text === '' || /^(\*|x|X|latest)$/.test(text))
54
+ return false;
55
+ const hyphen = text.match(/^(\S+)\s+-\s+(\S+)$/);
56
+ if (hyphen)
57
+ return majorOf(hyphen[2]) === 0;
58
+ let cappedBelowOne = false;
59
+ for (const token of text.split(/\s+/)) {
60
+ const match = token.match(/^(>=|<=|>|<|=)?\s*v?(.*)$/);
61
+ if (!match)
62
+ return false;
63
+ const [, op = '', version] = match;
64
+ const major = majorOf(version);
65
+ if (major === null)
66
+ return false;
67
+ switch (op) {
68
+ case '>':
69
+ case '>=':
70
+ if (major >= 1)
71
+ return false;
72
+ break;
73
+ case '<':
74
+ // `<1`, `<1.0`, `<1.0.0` exclude every v1; `<0.9` does too.
75
+ if (major === 0 || (major === 1 && /^1(\.0)*$/.test(version))) {
76
+ cappedBelowOne = true;
77
+ }
78
+ else {
79
+ return false;
80
+ }
81
+ break;
82
+ case '<=':
83
+ if (major === 0)
84
+ cappedBelowOne = true;
85
+ else
86
+ return false;
87
+ break;
88
+ default:
89
+ // `0.9.4`, `=0.9.4`, `^0.9`, `~0.7.5`, `0.x`: caret and tilde never
90
+ // cross a major, so major 0 stays below 1.
91
+ if (major === 0)
92
+ cappedBelowOne = true;
93
+ else
94
+ return false;
95
+ }
96
+ }
97
+ return cappedBelowOne;
98
+ }
99
+ function glueOperators(set) {
100
+ return set.trim().replace(/(>=|<=|>|<|=)\s+/g, '$1');
101
+ }
102
+ /**
103
+ * True when every comparator in every alternative parses to a semver major,
104
+ * so the headline can tell "already v1" apart from "not a version range at
105
+ * all" (`latest`, a git URL) rather than calling both v1.
106
+ */
107
+ function isRecognisedRange(range) {
108
+ return range
109
+ .trim()
110
+ .split(/\s*\|\|\s*/)
111
+ .every(alt => {
112
+ const text = glueOperators(alt);
113
+ if (/^(\*|x|X)$/.test(text))
114
+ return true;
115
+ const hyphen = text.match(/^(\S+)\s+-\s+(\S+)$/);
116
+ if (hyphen) {
117
+ return majorOf(hyphen[1]) !== null && majorOf(hyphen[2]) !== null;
118
+ }
119
+ return text
120
+ .split(/\s+/)
121
+ .every(tok => majorOf(tok.replace(/^(>=|<=|>|<|=)/, '')) !== null);
122
+ });
123
+ }
124
+ function majorOf(version) {
125
+ const m = version.replace(/^[~^=v]+/, '').match(/^(\d+)(?:\.|$)/);
126
+ return m ? Number(m[1]) : null;
127
+ }
128
+ export const updateDependencies = (filePath, pkg, collector, options) => {
129
+ const changes = [];
130
+ const next = pkg;
131
+ const section = (name) => (next[name] ?? undefined);
132
+ const note = (message) => {
133
+ changes.push(message);
134
+ collector?.add({ file: filePath, line: null, rule: 'deps', message });
135
+ };
136
+ // rbx goes away entirely.
137
+ const removed = [];
138
+ for (const name of DEP_SECTIONS) {
139
+ const deps = section(name);
140
+ if (deps && 'rbx' in deps) {
141
+ delete deps.rbx;
142
+ removed.push('rbx');
143
+ note(`removed rbx from ${name}`);
144
+ }
145
+ }
146
+ // The four Bulma extensions are REPORTED, not removed.
147
+ //
148
+ // rbx declares them as its own dependencies, so an app gets them
149
+ // transitively through the lockfile — they do not appear in the app's
150
+ // manifest unless the author put them there deliberately. A manifest entry
151
+ // is therefore a direct declaration, and an app may well be importing
152
+ // `bulma-tooltip`'s Sass on its own, outside anything rbx rendered.
153
+ // Deleting it because rbx happens to be present is precisely the
154
+ // best-guess rewrite this package refuses to make.
155
+ const extensions = [];
156
+ if (removed.includes('rbx')) {
157
+ for (const name of DEP_SECTIONS) {
158
+ const deps = section(name);
159
+ if (!deps)
160
+ continue;
161
+ for (const extension of RBX_STYLE_DEPS) {
162
+ if (extension in deps)
163
+ extensions.push(extension);
164
+ }
165
+ }
166
+ }
167
+ if (extensions.length > 0) {
168
+ collector?.add({
169
+ file: filePath,
170
+ line: null,
171
+ rule: 'deps',
172
+ message: `${extensions.join(', ')} ${extensions.length === 1 ? 'is a Bulma extension' : 'are Bulma extensions'} rbx depended on, and bestax ships ${extensions.length === 1 ? 'its' : 'their'} equivalent${extensions.length === 1 ? '' : 's'} (Badge, Divider, Loading, Tooltip). Declared in this manifest, so removing ${extensions.length === 1 ? 'it' : 'them'} is your call — drop ${extensions.length === 1 ? 'it' : 'them'} unless your own Sass imports ${extensions.length === 1 ? 'it' : 'them'} directly`,
173
+ });
174
+ }
175
+ // @allxsmith/bestax-bulma comes in (runtime dependency).
176
+ const dependencies = (next.dependencies ??= {});
177
+ if (!dependencies['@allxsmith/bestax-bulma'] &&
178
+ !section('devDependencies')?.['@allxsmith/bestax-bulma']) {
179
+ dependencies['@allxsmith/bestax-bulma'] = BESTAX_RANGE;
180
+ note(`added @allxsmith/bestax-bulma ${BESTAX_RANGE} to dependencies`);
181
+ }
182
+ // Bulma: rbx pinned 0.7.5 as a direct dependency, so this almost always
183
+ // fires. Add it back only when sources still reference bulma/… directly —
184
+ // otherwise it arrives transitively via bestax-bulma.
185
+ let bulmaDeclared = false;
186
+ let declaredBulma = '';
187
+ let bulmaBumped = false;
188
+ let bulmaAdded = false;
189
+ for (const name of DEP_SECTIONS) {
190
+ const deps = section(name);
191
+ if (deps?.bulma) {
192
+ bulmaDeclared = true;
193
+ declaredBulma = deps.bulma;
194
+ if (isPreV1(deps.bulma)) {
195
+ deps.bulma = BULMA_RANGE;
196
+ bulmaBumped = true;
197
+ note(`bumped bulma to ${BULMA_RANGE} in ${name} (was pre-1.0)`);
198
+ }
199
+ }
200
+ }
201
+ if (!bulmaDeclared && options.bulmaReferenced) {
202
+ dependencies.bulma = BULMA_RANGE;
203
+ bulmaAdded = true;
204
+ note(`added bulma ${BULMA_RANGE} to dependencies (sources import bulma/… directly)`);
205
+ }
206
+ // The transform deliberately keeps a trimmed rbx import for components
207
+ // with no bestax equivalent (Tile, Generic, List, …) so a partially
208
+ // migrated app still runs. Removing the package from the manifest strands
209
+ // exactly those imports once the user runs the install the report asks for,
210
+ // so say so rather than letting them find out at build time.
211
+ if (removed.includes('rbx') && options.sourceStillImported) {
212
+ collector?.add({
213
+ file: filePath,
214
+ line: null,
215
+ rule: 'deps',
216
+ message: 'rbx was removed from package.json, but some files still import it for components with no bestax equivalent — resolve those `TODO(bestax-migrate)` imports before installing, or re-add rbx until you have',
217
+ });
218
+ }
219
+ // The headline result: rbx pinned Bulma 0.7.5 as a DIRECT dependency, so
220
+ // removing rbx is what frees the app to choose its own Bulma version.
221
+ //
222
+ // What it must NOT claim is a manifest change that did not happen. In the
223
+ // common rbx-app shape — `{ "dependencies": { "rbx": "^2.2.0" } }` with no
224
+ // direct `bulma/…` imports — bulma is neither bumped nor added, because it
225
+ // arrives transitively via bestax-bulma. Saying "bumped bulma" there
226
+ // described a pin the user would not find in their manifest.
227
+ if (removed.includes('rbx')) {
228
+ collector?.add({
229
+ file: filePath,
230
+ line: null,
231
+ rule: 'deps',
232
+ message: `removed rbx ${bulmaBumped
233
+ ? `and bumped bulma to ${BULMA_RANGE}`
234
+ : bulmaAdded
235
+ ? `and added bulma ${BULMA_RANGE}`
236
+ : bulmaDeclared
237
+ ? isRecognisedRange(declaredBulma)
238
+ ? 'and left your declared bulma range alone (already v1)'
239
+ : `and left your declared bulma specifier alone (${JSON.stringify(declaredBulma)} is not a version range this tool can read; make sure it resolves to Bulma 1.x)`
240
+ : '— bulma now arrives transitively via @allxsmith/bestax-bulma'} — rbx pinned Bulma 0.7.5 as a direct dependency, so the app can now choose its own Bulma version${extensions.length > 0 ? `; ${extensions.length} Bulma extension(s) are reported above for you to remove` : ''}`,
241
+ });
242
+ }
243
+ // bestax-bulma requires React 18/19; rbx peer-depends on ^16.8.6, and React
244
+ // 19 removed the `defaultProps` its forwardRefAs base is built on — so this
245
+ // is the other half of why an rbx app is stuck. Report only: a React major
246
+ // upgrade is the app's own migration step.
247
+ for (const name of DEP_SECTIONS) {
248
+ const range = section(name)?.react;
249
+ if (range && /^[~^]?(?:[0-9]|1[0-7])(?:[.x]|$)/.test(range.trim())) {
250
+ collector?.add({
251
+ file: filePath,
252
+ line: null,
253
+ rule: 'peer-deps',
254
+ message: `react ${range} predates bestax-bulma's peer range (^18 || ^19) — upgrade react and react-dom to 18 or 19 before installing`,
255
+ });
256
+ }
257
+ }
258
+ // Font Awesome older than 6 conflicts with bestax-bulma's optional peer
259
+ // range and makes `npm install` fail with ERESOLVE. Report only — icon
260
+ // names change across FA majors, so upgrading is the app's decision.
261
+ for (const name of DEP_SECTIONS) {
262
+ const range = section(name)?.['@fortawesome/fontawesome-free'];
263
+ if (range && /^[~^]?[0-5](?:[.x]|$)/.test(range.trim())) {
264
+ collector?.add({
265
+ file: filePath,
266
+ line: null,
267
+ rule: 'peer-deps',
268
+ message: `@fortawesome/fontawesome-free ${range} predates bestax-bulma's optional peer range (^6.7.2 || ^7.0.0) — upgrade it, or install with \`npm install --legacy-peer-deps\``,
269
+ });
270
+ }
271
+ }
272
+ // node-sass is dead; dart-sass replaces it in the same section. rbx's own
273
+ // customisation guide told people to install node-sass, so this is common.
274
+ for (const name of DEP_SECTIONS) {
275
+ const deps = section(name);
276
+ if (deps && 'node-sass' in deps) {
277
+ delete deps['node-sass'];
278
+ note(`removed node-sass from ${name}`);
279
+ const sassDeclared = DEP_SECTIONS.some(s => section(s)?.sass);
280
+ if (!sassDeclared) {
281
+ deps.sass = SASS_RANGE;
282
+ note(`added sass ${SASS_RANGE} to ${name} (replaces node-sass)`);
283
+ }
284
+ }
285
+ }
286
+ return changes.length > 0 ? next : null;
287
+ };
@@ -0,0 +1,3 @@
1
+ import type { MigrationSource } from '../../types.js';
2
+ export declare const rbx: MigrationSource;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD,eAAO,MAAM,GAAG,EAAE,eAMjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import transform from './transform.js';
2
+ import { transformStyles } from './styles.js';
3
+ import { updateDependencies } from './deps.js';
4
+ export const rbx = {
5
+ name: 'rbx',
6
+ label: 'rbx (v2) → @allxsmith/bestax-bulma',
7
+ transform,
8
+ transformStyles,
9
+ updateDependencies,
10
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * rbx (v2) → @allxsmith/bestax-bulma mapping tables.
3
+ *
4
+ * Data only — no AST work. `MAPPING` is the single source of truth for what
5
+ * the transform does with each rbx export; `RBX_EXPORTS` vendors rbx's public
6
+ * surface so `mapping-coverage.test.ts` can close it in both directions.
7
+ *
8
+ * rbx and bestax both target Bulma, and rbx's helper vocabulary lines up with
9
+ * `useBulmaClasses` far more closely than react-bulma-components' did — most
10
+ * of the value unions below are identical on both sides, so they pass through
11
+ * rather than being value-mapped. Where they diverge it is because Bulma v1
12
+ * itself changed (`is-marginless` became `m-0`), and those are recorded as
13
+ * explicit conversions rather than guesses.
14
+ */
15
+ import type { ComponentMapping, PropAction } from '../../types.js';
16
+ /**
17
+ * Helper props rbx mixes into every component via `HelpersProps`. Applied
18
+ * after each component's own prop map, to whatever attributes are left.
19
+ *
20
+ * `badge*`, `tooltip*` and `responsive` are deliberately absent: they are
21
+ * consumed structurally (see specials.ts / responsive.ts) before this pass
22
+ * runs, and letting them fall through here would be wrong — bestax has its
23
+ * own unrelated `responsive` prop (`'mobile' | 'narrow'`), so a pass-through
24
+ * would silently produce a type error rather than a TODO.
25
+ */
26
+ export declare const UNIVERSAL_PROPS: Record<string, PropAction>;
27
+ /** rbx badge helper props → bestax `<Badge>` props. */
28
+ export declare const BADGE_PROPS: Record<string, string | null>;
29
+ /** rbx tooltip helper props → bestax `<Tooltip>` props. */
30
+ export declare const TOOLTIP_PROPS: Record<string, string | null>;
31
+ /**
32
+ * rbx breakpoints → the suffix bestax uses on its viewport-aware helper props
33
+ * (`displayTablet`, `textSizeDesktop`, …). `null` means bestax has no
34
+ * equivalent viewport, so the value becomes a TODO rather than a guess.
35
+ */
36
+ export declare const RESPONSIVE_BREAKPOINTS: Record<string, string | null>;
37
+ export declare const MAPPING: Record<string, ComponentMapping>;
38
+ /**
39
+ * rbx's public export surface, vendored from its five `index.ts` barrels at
40
+ * the pinned SHA. Values are the dot-notation sub-paths each export carries.
41
+ *
42
+ * `mapping-coverage.test.ts` walks this against `MAPPING` in both directions,
43
+ * so rbx coverage cannot silently regress and `MAPPING` cannot grow an entry
44
+ * for something rbx never exported.
45
+ */
46
+ export declare const RBX_EXPORTS: Record<string, string[]>;
47
+ /** Walk a dotted component path through `MAPPING`. */
48
+ export declare function resolveMapping(path: string[]): ComponentMapping | undefined;
49
+ //# sourceMappingURL=mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAuCnE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAiCtD,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAOrD,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAQvD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAShE,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAosBpD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA2FhD,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAM3E"}