bestax-migrate 2.1.2 → 2.1.4
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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/sources/react-bulma-components/jsx-utils.d.ts +11 -0
- package/dist/sources/react-bulma-components/jsx-utils.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/jsx-utils.js +15 -0
- package/dist/sources/react-bulma-components/props.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/props.js +4 -3
- package/dist/sources/react-bulma-components/specials.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/specials.js +51 -31
- package/dist/sources/react-bulma-components/styles.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/styles.js +139 -31
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAqBxE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,EAAE,CAkBV;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAkB5D;AAED,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,KAAK,EAAE,CAAC,OA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
package/dist/cli.js
CHANGED
|
@@ -55,6 +55,17 @@ export type LiteralValue = {
|
|
|
55
55
|
};
|
|
56
56
|
/** Extract the literal value of a JSX attribute, if it has one. */
|
|
57
57
|
export declare function literalValueOf(attr: any): LiteralValue;
|
|
58
|
+
export type Booleanish = 'truthy' | 'falsy' | 'expression';
|
|
59
|
+
/**
|
|
60
|
+
* Classify a JSX attribute by the truthiness RBC evaluates it with at
|
|
61
|
+
* runtime (`!!value`): every statically-known literal (boolean, string, or
|
|
62
|
+
* number) resolves to `'truthy'`/`'falsy'`; only a genuine expression is
|
|
63
|
+
* `'expression'`. This is the single place the six call sites that branch on
|
|
64
|
+
* a "booleanish" prop (Button `remove`, Heading `heading`/`subtitle`,
|
|
65
|
+
* `booleanToProp`, the `active` ladders, Field `multiline`) agree on what
|
|
66
|
+
* counts as resolvable, so they can't drift out of sync with each other.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveBooleanish(attr: any): Booleanish;
|
|
58
69
|
/** Create `name` (bare boolean) or `name="value"` attribute. */
|
|
59
70
|
export declare function makeAttr(j: JSCodeshift, name: string, value?: string): any;
|
|
60
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-utils.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/jsx-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMpD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,WAAW,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC;IACrC,uEAAuE;IACvE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,8EAA8E;IAC9E,MAAM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E,CAAC;AAE3B,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,GAAG,YAAY,CActD;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAE3D;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,UAAU,CAIvD;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,IAAI,CAuCN;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAC1B,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,GAAG,EAAE,EACZ,QAAQ,EAAE,GAAG,EAAE,EACf,WAAW,UAAQ,GAClB,GAAG,CAcL"}
|
|
@@ -70,6 +70,21 @@ export function literalValueOf(attr) {
|
|
|
70
70
|
}
|
|
71
71
|
return { kind: 'expression' };
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Classify a JSX attribute by the truthiness RBC evaluates it with at
|
|
75
|
+
* runtime (`!!value`): every statically-known literal (boolean, string, or
|
|
76
|
+
* number) resolves to `'truthy'`/`'falsy'`; only a genuine expression is
|
|
77
|
+
* `'expression'`. This is the single place the six call sites that branch on
|
|
78
|
+
* a "booleanish" prop (Button `remove`, Heading `heading`/`subtitle`,
|
|
79
|
+
* `booleanToProp`, the `active` ladders, Field `multiline`) agree on what
|
|
80
|
+
* counts as resolvable, so they can't drift out of sync with each other.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveBooleanish(attr) {
|
|
83
|
+
const literal = literalValueOf(attr);
|
|
84
|
+
if (literal.kind === 'expression')
|
|
85
|
+
return 'expression';
|
|
86
|
+
return literal.value ? 'truthy' : 'falsy';
|
|
87
|
+
}
|
|
73
88
|
/** Create `name` (bare boolean) or `name="value"` attribute. */
|
|
74
89
|
export function makeAttr(j, name, value) {
|
|
75
90
|
return j.jsxAttribute(j.jsxIdentifier(name), value === undefined ? null : j.stringLiteral(value));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/props.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/props.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EASL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AA6BxB,mDAAmD;AACnD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,UAAU,GACjB,IAAI,CA6HN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GACnB,IAAI,CAQN"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* universal modifier-prop pass shared by every mapped component.
|
|
4
4
|
*/
|
|
5
5
|
import { UNIVERSAL_PROPS } from './mapping.js';
|
|
6
|
-
import { addAttr, addTodo, attributesOf, findAttr, literalValueOf, makeAttr, removeAttr, } from './jsx-utils.js';
|
|
6
|
+
import { addAttr, addTodo, attributesOf, findAttr, literalValueOf, makeAttr, removeAttr, resolveBooleanish, } from './jsx-utils.js';
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
8
|
/**
|
|
9
9
|
* Add a converted attribute unless the target name is already present — two
|
|
@@ -56,12 +56,13 @@ export function applyPropAction(ctx, path, element, attr, action) {
|
|
|
56
56
|
}
|
|
57
57
|
if (action.booleanToProp) {
|
|
58
58
|
const { name, value } = action.booleanToProp;
|
|
59
|
-
|
|
59
|
+
const resolved = resolveBooleanish(attr);
|
|
60
|
+
if (resolved === 'truthy') {
|
|
60
61
|
removeAttr(element, attr);
|
|
61
62
|
addConverted(ctx, path, element, originalName, name, value);
|
|
62
63
|
ctx.dirty = true;
|
|
63
64
|
}
|
|
64
|
-
else if (
|
|
65
|
+
else if (resolved === 'falsy') {
|
|
65
66
|
removeAttr(element, attr);
|
|
66
67
|
ctx.dirty = true;
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAWL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAo3BD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAIf;AAED,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAGjE,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* element `replaced` when it substituted the node itself.
|
|
9
9
|
*/
|
|
10
10
|
import { RESPONSIVE_BREAKPOINTS, UNIVERSAL_PROPS } from './mapping.js';
|
|
11
|
-
import { addAttr, addTodo, attributesOf, buildJsxName, findAttr, literalValueOf, makeAttr, plainElement, removeAttr, } from './jsx-utils.js';
|
|
11
|
+
import { addAttr, addTodo, attributesOf, buildJsxName, findAttr, literalValueOf, makeAttr, plainElement, removeAttr, resolveBooleanish, } from './jsx-utils.js';
|
|
12
12
|
/** Pick a target based on a literal align-style prop, removing the prop. */
|
|
13
13
|
function alignTarget(ctx, path, element, prop, targets, fallback) {
|
|
14
14
|
const attr = findAttr(element, prop);
|
|
@@ -141,14 +141,14 @@ const SPECIALS = {
|
|
|
141
141
|
const attr = findAttr(element, 'remove');
|
|
142
142
|
if (!attr)
|
|
143
143
|
return {};
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
144
|
+
const resolved = resolveBooleanish(attr);
|
|
145
|
+
if (resolved !== 'expression') {
|
|
146
146
|
// A statically-known value always renders the same at runtime: truthy
|
|
147
147
|
// (`remove`, `remove={true}`, `remove="true"`) → `<Delete />`; falsy
|
|
148
148
|
// (`remove={false}`, `remove=""`, `remove={0}`) → just drop the prop.
|
|
149
149
|
removeAttr(element, attr);
|
|
150
150
|
ctx.dirty = true;
|
|
151
|
-
return
|
|
151
|
+
return resolved === 'truthy' ? { target: 'Delete' } : {};
|
|
152
152
|
}
|
|
153
153
|
addTodo(ctx, path, 'prop:remove', '`remove` has a dynamic value; this can render as either a Button or a Delete cross — split the branch by hand');
|
|
154
154
|
return {};
|
|
@@ -172,14 +172,18 @@ const SPECIALS = {
|
|
|
172
172
|
heading(ctx, path, element) {
|
|
173
173
|
const headingAttr = findAttr(element, 'heading');
|
|
174
174
|
const subtitleAttr = findAttr(element, 'subtitle');
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
175
|
+
const headingResolved = headingAttr
|
|
176
|
+
? resolveBooleanish(headingAttr)
|
|
177
|
+
: undefined;
|
|
178
|
+
const subtitleResolved = subtitleAttr
|
|
179
|
+
? resolveBooleanish(subtitleAttr)
|
|
180
|
+
: undefined;
|
|
181
|
+
const headingDynamic = headingResolved === 'expression';
|
|
182
|
+
const subtitleDynamic = subtitleResolved === 'expression';
|
|
179
183
|
// A resolvable literal (boolean/string/number) collapses to its runtime
|
|
180
184
|
// truthiness; an expression stays dynamic.
|
|
181
|
-
const headingTruthy =
|
|
182
|
-
const subtitleTruthy =
|
|
185
|
+
const headingTruthy = headingResolved === 'truthy';
|
|
186
|
+
const subtitleTruthy = subtitleResolved === 'truthy';
|
|
183
187
|
// Dynamic values can't be resolved to a target: leave the prop on the
|
|
184
188
|
// element (so its expression survives for hand-splitting) plus a TODO.
|
|
185
189
|
if (subtitleDynamic) {
|
|
@@ -205,11 +209,11 @@ const SPECIALS = {
|
|
|
205
209
|
// A resolvable literal `heading` that didn't collapse (falsy, or truthy
|
|
206
210
|
// but blocked by a dynamic subtitle) behaves as if the prop were absent —
|
|
207
211
|
// drop it. A dynamic `heading` stays put (its TODO is already filed above).
|
|
208
|
-
if (
|
|
212
|
+
if (headingAttr && !headingDynamic) {
|
|
209
213
|
removeAttr(element, headingAttr);
|
|
210
214
|
ctx.dirty = true;
|
|
211
215
|
}
|
|
212
|
-
if (
|
|
216
|
+
if (subtitleAttr && !subtitleDynamic) {
|
|
213
217
|
removeAttr(element, subtitleAttr);
|
|
214
218
|
ctx.dirty = true;
|
|
215
219
|
return { target: subtitleTruthy ? 'SubTitle' : 'Title' };
|
|
@@ -313,35 +317,55 @@ const SPECIALS = {
|
|
|
313
317
|
if ((kind && kind.kind !== 'string') ||
|
|
314
318
|
(align && align.kind !== 'string')) {
|
|
315
319
|
addTodo(ctx, path, 'prop:kind', 'dynamic Field kind/align; map to the bestax `grouped` / `hasAddons` props by hand');
|
|
316
|
-
|
|
320
|
+
// This handler owns `multiline` end-to-end; without this, the mapping's
|
|
321
|
+
// fallback `multiline: { drop: true }` prop action would silently strip
|
|
322
|
+
// a dynamic `multiline` the moment kind/align themselves are dynamic.
|
|
323
|
+
return { handledProps: ['multiline'] };
|
|
317
324
|
}
|
|
318
|
-
|
|
325
|
+
// `multiline` is a value, not just presence: a falsy literal drops it
|
|
326
|
+
// (same as it being absent) and a dynamic value must survive on the
|
|
327
|
+
// element — so, unlike `kind`/`align`, it's only stripped once resolved.
|
|
328
|
+
const multilineResolved = multilineAttr
|
|
329
|
+
? resolveBooleanish(multilineAttr)
|
|
330
|
+
: null;
|
|
331
|
+
const multilineDynamic = multilineResolved === 'expression';
|
|
332
|
+
const multilineTruthy = multilineResolved === 'truthy';
|
|
333
|
+
const kindOrAlignPresent = Boolean(kindAttr || alignAttr);
|
|
334
|
+
for (const attr of [kindAttr, alignAttr]) {
|
|
319
335
|
if (attr)
|
|
320
336
|
removeAttr(element, attr);
|
|
321
337
|
}
|
|
322
|
-
|
|
338
|
+
if (multilineAttr && !multilineDynamic) {
|
|
339
|
+
removeAttr(element, multilineAttr);
|
|
340
|
+
}
|
|
341
|
+
if (kindOrAlignPresent || (multilineAttr && !multilineDynamic)) {
|
|
342
|
+
ctx.dirty = true;
|
|
343
|
+
}
|
|
323
344
|
const alignValue = align && align.kind === 'string'
|
|
324
345
|
? { center: 'centered', right: 'right' }[align.value]
|
|
325
346
|
: undefined;
|
|
347
|
+
if (multilineDynamic) {
|
|
348
|
+
addTodo(ctx, path, 'prop:multiline', '`multiline` has a dynamic value; resolve the bestax `grouped`/`hasAddons` combination by hand');
|
|
349
|
+
}
|
|
326
350
|
if (kind && kind.kind === 'string' && kind.value === 'addons') {
|
|
327
351
|
addAttr(element, makeAttr(ctx.j, 'hasAddons', alignValue));
|
|
328
|
-
if (
|
|
352
|
+
if (multilineTruthy) {
|
|
329
353
|
addTodo(ctx, path, 'prop:multiline', "`multiline` only combines with kind='group' in Bulma; dropped from this addons Field");
|
|
330
354
|
}
|
|
331
|
-
return {};
|
|
355
|
+
return { handledProps: ['multiline'] };
|
|
332
356
|
}
|
|
333
357
|
// kind='group' (or a stray multiline/align without kind)
|
|
334
|
-
if (
|
|
358
|
+
if (multilineTruthy) {
|
|
335
359
|
addAttr(element, makeAttr(ctx.j, 'grouped', 'multiline'));
|
|
336
360
|
if (alignValue) {
|
|
337
361
|
addTodo(ctx, path, 'prop:align', 'bestax `grouped` takes one value; choose between multiline and ' +
|
|
338
362
|
alignValue);
|
|
339
363
|
}
|
|
340
364
|
}
|
|
341
|
-
else {
|
|
365
|
+
else if (kindOrAlignPresent) {
|
|
342
366
|
addAttr(element, makeAttr(ctx.j, 'grouped', alignValue));
|
|
343
367
|
}
|
|
344
|
-
return {};
|
|
368
|
+
return { handledProps: ['multiline'] };
|
|
345
369
|
},
|
|
346
370
|
/** Form.Label → plain <label className="label">. */
|
|
347
371
|
'plain-label'(ctx, path, element) {
|
|
@@ -472,18 +496,14 @@ const SPECIALS = {
|
|
|
472
496
|
const activeAttr = findAttr(element, 'active');
|
|
473
497
|
let className;
|
|
474
498
|
if (activeAttr) {
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
499
|
+
const resolved = resolveBooleanish(activeAttr);
|
|
500
|
+
if (resolved === 'truthy') {
|
|
477
501
|
className = 'is-active';
|
|
478
|
-
removeAttr(element, activeAttr);
|
|
479
|
-
}
|
|
480
|
-
else if (literal.kind === 'boolean') {
|
|
481
|
-
removeAttr(element, activeAttr);
|
|
482
502
|
}
|
|
483
|
-
else {
|
|
503
|
+
else if (resolved === 'expression') {
|
|
484
504
|
addTodo(ctx, path, 'prop:active', "dynamic Panel.Tabs.Tab active; set className={active ? 'is-active' : undefined} by hand");
|
|
485
|
-
removeAttr(element, activeAttr);
|
|
486
505
|
}
|
|
506
|
+
removeAttr(element, activeAttr);
|
|
487
507
|
}
|
|
488
508
|
className = mergeClassName(ctx, path, element, className, 'Panel.Tabs.Tab');
|
|
489
509
|
const rest = stripModifierProps(ctx, path, attributesOf(element), 'Panel.Tabs.Tab');
|
|
@@ -497,10 +517,10 @@ const SPECIALS = {
|
|
|
497
517
|
const activeAttr = findAttr(element, 'active');
|
|
498
518
|
let liClass;
|
|
499
519
|
if (activeAttr) {
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
520
|
+
const resolved = resolveBooleanish(activeAttr);
|
|
521
|
+
if (resolved === 'truthy')
|
|
502
522
|
liClass = 'is-active';
|
|
503
|
-
else if (
|
|
523
|
+
else if (resolved === 'expression') {
|
|
504
524
|
addTodo(ctx, path, 'prop:active', "dynamic Breadcrumb.Item active; set the li className={active ? 'is-active' : undefined} by hand");
|
|
505
525
|
}
|
|
506
526
|
removeAttr(element, activeAttr);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AA+MrE,eAAO,MAAM,eAAe,EAAE,eA2R7B,CAAC"}
|
|
@@ -55,9 +55,43 @@ const OTHER_BULMA_IMPORT = /^\s*@import\s+['"][^'"]*bulma[^'"]*['"]/;
|
|
|
55
55
|
/**
|
|
56
56
|
* Third-party Bulma extension packages (`bulma-checkradio`, `bulma-switch`,
|
|
57
57
|
* …) — 0.9-era add-ons whose v1 compatibility varies; several are covered
|
|
58
|
-
* by the bestax extras.
|
|
58
|
+
* by the bestax extras. The `bulma-` package name must start at a specifier
|
|
59
|
+
* segment boundary (right after the quote/`~`, or after a `/`) so this does
|
|
60
|
+
* not also match a name that merely *contains* `bulma-`, like
|
|
61
|
+
* `react-bulma-components` (see EXTENSION_IMPORT's own regression test).
|
|
59
62
|
*/
|
|
60
|
-
const EXTENSION_IMPORT = /^\s*@import\s+['"][^'"]
|
|
63
|
+
const EXTENSION_IMPORT = /^\s*@import\s+['"](?:~|[^'"]*\/)?bulma-([\w-]+?)(?:\/|\.|['"])/;
|
|
64
|
+
/**
|
|
65
|
+
* The source library's own stylesheet. This is not a third-party extension:
|
|
66
|
+
* it is the library being migrated away from, and `deps.ts` removes its
|
|
67
|
+
* package.json entry in the same run, so leaving the import in place breaks
|
|
68
|
+
* the Sass build. Any `react-bulma-components/…` specifier is dead the same
|
|
69
|
+
* way — the documented v3 setup paths (the bundled CSS, the "advanced" Sass
|
|
70
|
+
* entry point), but also deep partials and extensionless forms — so, like
|
|
71
|
+
* `transform.ts`, we match on the package prefix rather than enumerating
|
|
72
|
+
* shapes. The prefix may be bare, `~`-prefixed, or a relative node_modules
|
|
73
|
+
* path (the Parcel form `ROOT_IMPORT` also supports).
|
|
74
|
+
*/
|
|
75
|
+
const RBC_STYLE_IMPORT = /^(\s*)@import\s+(['"])((?:\.\.?\/)+node_modules\/|~)?react-bulma-components\/[^'"]*\2\s*;?\s*$/;
|
|
76
|
+
/**
|
|
77
|
+
* The subset of RBC stylesheet imports that are the library's own *root*: the
|
|
78
|
+
* bare package specifier, the documented Sass entry point (`src/index`), and
|
|
79
|
+
* the bundled v3 CSS (`dist/react-bulma-components(.min).css`). These pull in
|
|
80
|
+
* the whole library, which `bulma/sass` supersedes — so when the file already
|
|
81
|
+
* has a Bulma root, dropping one of these loses nothing. A deep RBC partial
|
|
82
|
+
* (`src/components/navbar.sass`) is NOT a root: `bulma/sass` doesn't carry a
|
|
83
|
+
* given partial's styles, so removing one silently would drop CSS. We flag
|
|
84
|
+
* those instead (the package's "never a silent skip" rule).
|
|
85
|
+
*/
|
|
86
|
+
const RBC_ROOT_STYLESHEET = /^\s*@import\s+(['"])(?:(?:\.\.?\/)+node_modules\/|~)?react-bulma-components(?:\/src\/index(?:\.s[ac]ss)?|\/dist\/react-bulma-components(?:\.min)?\.css)?\1\s*;?\s*$/;
|
|
87
|
+
/**
|
|
88
|
+
* A Bulma module root already pulled in via `@use` — the file's own
|
|
89
|
+
* `@use 'bulma/sass'` (any prefix, configured or not) or the bestax bundle
|
|
90
|
+
* (`scss/bestax`, which itself loads `bulma/sass with (…)`). When one is
|
|
91
|
+
* present we must not emit a second root: a duplicate `bulma/sass` namespace,
|
|
92
|
+
* or reconfiguring an already-loaded module, is a hard Sass error.
|
|
93
|
+
*/
|
|
94
|
+
const USE_BULMA_ROOT = /^\s*@use\s+(['"])(?:~|(?:\.\.?\/)+node_modules\/)?(?:bulma\/sass|@allxsmith\/bestax-bulma\/(?:src\/)?scss\/bestax)\1/;
|
|
61
95
|
/** Any `$name: value;` declaration (with or without `!default`). */
|
|
62
96
|
const VAR_DECL = /^\s*\$([\w-]+)\s*:\s*(.+?)\s*(!default)?\s*;\s*$/;
|
|
63
97
|
/**
|
|
@@ -171,12 +205,23 @@ export const transformStyles = (filePath, source, collector, options) => {
|
|
|
171
205
|
const out = [];
|
|
172
206
|
let changed = false;
|
|
173
207
|
let extrasAdded = source.includes('@allxsmith/bestax-bulma/scss');
|
|
174
|
-
// Pass 1:
|
|
208
|
+
// Pass 1: locate the file's Bulma root and the safe leading variable
|
|
209
|
+
// overrides that fold into it. A real `bulma/…` @import root wins; otherwise
|
|
210
|
+
// the RBC stylesheet, which we rewrite into a root the same way — so a file
|
|
211
|
+
// that starts from RBC and one that starts from a bulma @import converge on
|
|
212
|
+
// the identical shape. A pre-existing `@use` root means we create no new one.
|
|
175
213
|
const rootImportIndex = lines.findIndex(line => ROOT_IMPORT.test(line));
|
|
214
|
+
const rbcRootIndex = lines.findIndex(line => RBC_STYLE_IMPORT.test(line) && !line.includes(TODO));
|
|
215
|
+
const hasUseBulmaRoot = lines.some(line => USE_BULMA_ROOT.test(line));
|
|
216
|
+
const foldTargetIndex = hasUseBulmaRoot
|
|
217
|
+
? -1
|
|
218
|
+
: rootImportIndex !== -1
|
|
219
|
+
? rootImportIndex
|
|
220
|
+
: rbcRootIndex;
|
|
176
221
|
const foldableVars = [];
|
|
177
222
|
const unsafeVarLines = [];
|
|
178
|
-
if (
|
|
179
|
-
for (let i = 0; i <
|
|
223
|
+
if (foldTargetIndex !== -1) {
|
|
224
|
+
for (let i = 0; i < foldTargetIndex; i += 1) {
|
|
180
225
|
const line = lines[i];
|
|
181
226
|
const match = line.match(VAR_DECL);
|
|
182
227
|
if (match && isFoldableValue(match[2])) {
|
|
@@ -188,36 +233,43 @@ export const transformStyles = (filePath, source, collector, options) => {
|
|
|
188
233
|
}
|
|
189
234
|
}
|
|
190
235
|
const folded = new Set(foldableVars.map(v => v.index));
|
|
236
|
+
/**
|
|
237
|
+
* Emit a Bulma module root at `indent` (folding the leading var overrides
|
|
238
|
+
* gathered above into `with (…)`, flagging any unsafe ones), then, in
|
|
239
|
+
* bestax mode, the extras. `prefix` is a preserved relative-path prefix
|
|
240
|
+
* (raw-file toolchains resolve paths, not package specifiers) or ''.
|
|
241
|
+
*/
|
|
242
|
+
const emitBulmaRoot = (indent, prefix, lineNo) => {
|
|
243
|
+
const bulmaSass = `${prefix}bulma/sass`;
|
|
244
|
+
if (foldableVars.length > 0) {
|
|
245
|
+
out.push(`${indent}@use '${bulmaSass}' with (`);
|
|
246
|
+
foldableVars.forEach(({ name, value }, index) => {
|
|
247
|
+
const comma = index < foldableVars.length - 1 ? ',' : '';
|
|
248
|
+
out.push(`${indent} $${name}: ${formatFoldedValue(value)}${comma}`);
|
|
249
|
+
});
|
|
250
|
+
out.push(`${indent});`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
out.push(`${indent}@use '${bulmaSass}';`);
|
|
254
|
+
}
|
|
255
|
+
if (unsafeVarLines.length > 0) {
|
|
256
|
+
out.push(`${indent}// ${TODO}: the variable override(s) above use computed values; move them into the @use "bulma/sass" with (…) configuration by hand`);
|
|
257
|
+
report(collector, filePath, lineNo, 'sass', 'variable overrides with computed values could not be folded into `with (…)`');
|
|
258
|
+
}
|
|
259
|
+
if (cssMode === 'bestax' && !extrasAdded) {
|
|
260
|
+
out.push(prefix
|
|
261
|
+
? `${indent}@use '${prefix}@allxsmith/bestax-bulma/src/scss/extras';`
|
|
262
|
+
: `${indent}${EXTRAS_USE}`);
|
|
263
|
+
extrasAdded = true;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
191
266
|
for (let i = 0; i < lines.length; i += 1) {
|
|
192
267
|
const line = lines[i];
|
|
193
268
|
if (i === rootImportIndex) {
|
|
194
269
|
const rootMatch = line.match(ROOT_IMPORT);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
out.push(`${indent}@use '${bulmaSass}' with (`);
|
|
199
|
-
foldableVars.forEach(({ name, value }, index) => {
|
|
200
|
-
const comma = index < foldableVars.length - 1 ? ',' : '';
|
|
201
|
-
out.push(`${indent} $${name}: ${formatFoldedValue(value)}${comma}`);
|
|
202
|
-
});
|
|
203
|
-
out.push(`${indent});`);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
out.push(`${indent}@use '${bulmaSass}';`);
|
|
207
|
-
}
|
|
208
|
-
if (unsafeVarLines.length > 0) {
|
|
209
|
-
out.push(`${indent}// ${TODO}: the variable override(s) above use computed values; move them into the @use "bulma/sass" with (…) configuration by hand`);
|
|
210
|
-
report(collector, filePath, i + 1, 'sass', 'variable overrides with computed values could not be folded into `with (…)`');
|
|
211
|
-
}
|
|
212
|
-
if (cssMode === 'bestax' && !extrasAdded) {
|
|
213
|
-
// A path-prefixed root import means the toolchain resolves raw file
|
|
214
|
-
// paths, not package specifiers — point at the shipped file directly.
|
|
215
|
-
const extrasPrefix = keptPrefix(rootMatch?.[3]);
|
|
216
|
-
out.push(extrasPrefix
|
|
217
|
-
? `${indent}@use '${extrasPrefix}@allxsmith/bestax-bulma/src/scss/extras';`
|
|
218
|
-
: `${indent}${EXTRAS_USE}`);
|
|
219
|
-
extrasAdded = true;
|
|
220
|
-
}
|
|
270
|
+
// A path-prefixed root import means the toolchain resolves raw file
|
|
271
|
+
// paths, not package specifiers — point at the shipped files directly.
|
|
272
|
+
emitBulmaRoot(rootMatch?.[1] ?? '', keptPrefix(rootMatch?.[3]), i + 1);
|
|
221
273
|
changed = true;
|
|
222
274
|
continue;
|
|
223
275
|
}
|
|
@@ -263,6 +315,62 @@ export const transformStyles = (filePath, source, collector, options) => {
|
|
|
263
315
|
changed = true;
|
|
264
316
|
continue;
|
|
265
317
|
}
|
|
318
|
+
const rbcStyle = line.match(RBC_STYLE_IMPORT);
|
|
319
|
+
if (rbcStyle && !line.includes(TODO)) {
|
|
320
|
+
const indent = rbcStyle[1];
|
|
321
|
+
const prefix = keptPrefix(rbcStyle[3]);
|
|
322
|
+
if (i === rbcRootIndex && rootImportIndex === -1 && !hasUseBulmaRoot) {
|
|
323
|
+
// The library's own stylesheet never resolves post-migration (deps.ts
|
|
324
|
+
// removes react-bulma-components in the same run), and it is this
|
|
325
|
+
// file's only Bulma root, so rewrite it into one — the same shape the
|
|
326
|
+
// @import root path emits, folding any leading var overrides. Emitting
|
|
327
|
+
// a real `bulma/sass` (+ extras) rather than the hard-configured
|
|
328
|
+
// bestax bundle keeps this convergent with the @import path and avoids
|
|
329
|
+
// reconfiguring `bulma/sass` if a themed root exists elsewhere.
|
|
330
|
+
emitBulmaRoot(indent, prefix, i + 1);
|
|
331
|
+
if (cssMode === 'keep') {
|
|
332
|
+
// The replacement is unavoidable even in keep mode: RBC's own
|
|
333
|
+
// stylesheet is a v3 (Bulma 0.9) asset the migrated v1 components
|
|
334
|
+
// can't use. What changed depends on whether the manifest step ran.
|
|
335
|
+
const depsRan = options.deps !== false;
|
|
336
|
+
const detail = depsRan
|
|
337
|
+
? 'its package.json entry is removed, so the old import no longer resolves; install bulma@^1'
|
|
338
|
+
: 'it targets Bulma 0.9, not the v1 your components now use; --no-deps kept the dependency, so install bulma@^1 alongside it';
|
|
339
|
+
out.push(`${indent}// ${TODO}: replaced react-bulma-components's own stylesheet with @use 'bulma/sass' — ${detail} — see ${GUIDE}`);
|
|
340
|
+
report(collector, filePath, i + 1, 'sass', depsRan
|
|
341
|
+
? "replaced react-bulma-components's stylesheet import with bulma/sass; the package is removed from dependencies, so the old import would not resolve"
|
|
342
|
+
: "replaced react-bulma-components's stylesheet import with bulma/sass; it is a Bulma 0.9 asset the migrated v1 components can't use (--no-deps left the package in place)");
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
// bestax/bulma modes rewrite the file's root without a TODO — still
|
|
346
|
+
// report it so the migration summary reflects the restructured root.
|
|
347
|
+
report(collector, filePath, i + 1, 'sass', "replaced react-bulma-components's stylesheet import with a Bulma v1 @use root");
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
// A Bulma root already covers this file (a `bulma/…` @import we
|
|
352
|
+
// convert, the file's own `@use` root, or an earlier RBC line we
|
|
353
|
+
// rewrote). In bestax mode keep that root and add only the extras —
|
|
354
|
+
// never a second root, never the configured bundle that would
|
|
355
|
+
// reconfigure an already-loaded module.
|
|
356
|
+
if (cssMode === 'bestax' && !extrasAdded) {
|
|
357
|
+
out.push(prefix
|
|
358
|
+
? `${indent}@use '${prefix}@allxsmith/bestax-bulma/src/scss/extras';`
|
|
359
|
+
: `${indent}${EXTRAS_USE}`);
|
|
360
|
+
extrasAdded = true;
|
|
361
|
+
}
|
|
362
|
+
// Dropping the RBC line is only safe for its root/index stylesheet,
|
|
363
|
+
// which `bulma/sass` supersedes. A deep RBC partial can carry styles
|
|
364
|
+
// `bulma/sass` doesn't, so removing it silently would lose CSS — flag
|
|
365
|
+
// it with a TODO + report entry instead (never a silent skip).
|
|
366
|
+
if (!RBC_ROOT_STYLESHEET.test(line)) {
|
|
367
|
+
out.push(`${indent}// ${TODO}: dropped a react-bulma-components stylesheet partial that has no Bulma v1 root equivalent; port any styles it carried beyond Bulma's own by hand — see ${GUIDE}`);
|
|
368
|
+
report(collector, filePath, i + 1, 'sass', 'react-bulma-components stylesheet partial dropped; port any styles it carried beyond Bulma’s own by hand');
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
changed = true;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
266
374
|
if (OTHER_BULMA_IMPORT.test(line) && !line.includes(TODO)) {
|
|
267
375
|
const extension = line.match(EXTENSION_IMPORT);
|
|
268
376
|
if (extension) {
|
package/dist/types.d.ts
CHANGED
|
@@ -95,6 +95,13 @@ export type CssMode = 'bestax' | 'bulma' | 'keep';
|
|
|
95
95
|
export interface TransformOptions {
|
|
96
96
|
collector?: TodoCollector;
|
|
97
97
|
cssMode?: CssMode;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the run also updates package.json (false under `--no-deps`).
|
|
100
|
+
* The stylesheet transform's messaging depends on it: it may only claim a
|
|
101
|
+
* dependency was removed when the manifest step actually runs. Undefined is
|
|
102
|
+
* treated as the CLI default (deps on).
|
|
103
|
+
*/
|
|
104
|
+
deps?: boolean;
|
|
98
105
|
[key: string]: unknown;
|
|
99
106
|
}
|
|
100
107
|
/** Options for the package.json dependency updater. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG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AAgB,KACtB,MAAM,GAAG,SAAS,CAAC;AAExB,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,CAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,OAAO,EAAE,gBAAgB,KACtB,MAAM,GAAG,IAAI,CAAC;AAEnB,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAC/B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;AAEpC,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Codemods for migrating existing React apps from other Bulma libraries to @allxsmith/bestax-bulma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-dom": "^19.2.8",
|
|
52
52
|
"ts-jest": "^29.4.12",
|
|
53
53
|
"typescript": "^6.0.3",
|
|
54
|
-
"@allxsmith/bestax-bulma": "^5.11.
|
|
54
|
+
"@allxsmith/bestax-bulma": "^5.11.4"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|