bestax-migrate 2.34.1 → 2.35.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.
- package/dist/sources/_shared/jsx-utils.d.ts +14 -0
- package/dist/sources/_shared/jsx-utils.d.ts.map +1 -1
- package/dist/sources/_shared/specials-utils.d.ts +19 -0
- package/dist/sources/_shared/specials-utils.d.ts.map +1 -1
- package/dist/sources/_shared/specials-utils.js +42 -0
- package/dist/sources/bloomer/specials.d.ts.map +1 -1
- package/dist/sources/bloomer/specials.js +2 -2
- package/dist/sources/rbx/mapping.d.ts.map +1 -1
- package/dist/sources/rbx/mapping.js +7 -5
- package/dist/sources/rbx/specials.d.ts.map +1 -1
- package/dist/sources/rbx/specials.js +82 -3
- package/dist/sources/rbx/transform.d.ts.map +1 -1
- package/dist/sources/rbx/transform.js +42 -1
- package/dist/sources/react-bulma-components/specials.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/specials.js +2 -1
- package/package.json +11 -13
|
@@ -35,8 +35,22 @@ export interface TransformContext {
|
|
|
35
35
|
* source's transform).
|
|
36
36
|
*/
|
|
37
37
|
resolve?: (name: any) => string[] | null;
|
|
38
|
+
/**
|
|
39
|
+
* What the JSX element at `path` renders, read by binding: a component of
|
|
40
|
+
* the source library or of bestax, or null for anything else, a local that
|
|
41
|
+
* shadows one of them included (set by the source's transform where a
|
|
42
|
+
* handler needs it).
|
|
43
|
+
*/
|
|
44
|
+
resolveElement?: (path: any) => ResolvedElement | null;
|
|
38
45
|
dirty: boolean;
|
|
39
46
|
}
|
|
47
|
+
/** A JSX element's component, as `TransformContext.resolveElement` reads it. */
|
|
48
|
+
export interface ResolvedElement {
|
|
49
|
+
/** `source` for the library being migrated from, `bestax` for bestax. */
|
|
50
|
+
library: 'source' | 'bestax';
|
|
51
|
+
/** The component's path in that library, such as `['Field', 'Body']`. */
|
|
52
|
+
parts: string[];
|
|
53
|
+
}
|
|
40
54
|
/** Flatten a JSXIdentifier / JSXMemberExpression chain into name parts. */
|
|
41
55
|
export declare function jsxNameParts(name: any): string[] | null;
|
|
42
56
|
/** Build a JSXIdentifier / JSXMemberExpression chain from a dotted name. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-utils.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/jsx-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,2EAA2E;IAC3E,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,8EAA8E;IAC9E,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B;;;;OAIG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,EAAE,GAAG,IAAI,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,IAAI,CASvD;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAOhE;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAC3B,CAAC,EAAE,WAAW,EACd,OA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`, which does not compile.
|
|
117
117
|
*/
|
|
118
118
|
export declare function dropLinkAttrsForPlainTag(ctx: TransformContext, path: ASTPath<any>, element: any, tag: string, where: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Flag a `Heading` label that became a plain element carrying `heading`.
|
|
121
|
+
*
|
|
122
|
+
* Each library source has a `Heading` that rendered Bulma 0.9's `.heading`
|
|
123
|
+
* label, and bestax has no component for it, so it stays plain markup with
|
|
124
|
+
* the class. Bulma v1 has no rule for `.heading`, so the class styles nothing
|
|
125
|
+
* there. One rule and one message keep the sources agreeing about that
|
|
126
|
+
* (#1370). The message suggests the helper props for a small, uppercase,
|
|
127
|
+
* semibold label, or a `.heading` rule of the app's own.
|
|
128
|
+
*/
|
|
129
|
+
export declare function flagDroppedHeading(ctx: TransformContext, path: ASTPath<any>, tag: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* The bestax components that render one way inside a `Field` and another
|
|
132
|
+
* outside one: each reads `useInsideField`, and most render a `Field` of
|
|
133
|
+
* their own outside one. A `Fieldset` starts a Field scope of its own, so
|
|
134
|
+
* one of these placed straight in it renders the outside way. The
|
|
135
|
+
* `field-scoped` test holds this to the library's form components.
|
|
136
|
+
*/
|
|
137
|
+
export declare const FIELD_SCOPED: ReadonlySet<string>;
|
|
119
138
|
/** Attribute filter a source applies before an element becomes plain HTML. */
|
|
120
139
|
export type AttrStrip = (ctx: TransformContext, path: ASTPath<any>, attrs: any[], where: string) => any[];
|
|
121
140
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials-utils.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/specials-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQjD,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAIxB,MA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,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,IAAI,CA2CN;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,GAAG,EAAE,MAAM,GACV,IAAI,CAON;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAqB3C,CAAC;AAEH,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,CACtB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,KAAK,EAAE,GAAG,EAAE,EACZ,KAAK,EAAE,MAAM,KACV,GAAG,EAAE,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS;4BAG7C,gBAAgB,QACf,OAAO,CAAC,GAAG,CAAC,WACT,GAAG,OACP,MAAM,aACA,MAAM,GAAG,SAAS,SACtB,MAAM,KACZ,aAAa;6BA2CT,gBAAgB,QACf,OAAO,CAAC,GAAG,CAAC,WACT,GAAG,SACL,MAAM,YACH,MAAM,GAAG,MAAM,EAAE,KAC1B,aAAa,GAAG,IAAI;EA8CxB"}
|
|
@@ -349,6 +349,48 @@ export function dropLinkAttrsForPlainTag(ctx, path, element, tag, where) {
|
|
|
349
349
|
ctx.dirty = true;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Flag a `Heading` label that became a plain element carrying `heading`.
|
|
354
|
+
*
|
|
355
|
+
* Each library source has a `Heading` that rendered Bulma 0.9's `.heading`
|
|
356
|
+
* label, and bestax has no component for it, so it stays plain markup with
|
|
357
|
+
* the class. Bulma v1 has no rule for `.heading`, so the class styles nothing
|
|
358
|
+
* there. One rule and one message keep the sources agreeing about that
|
|
359
|
+
* (#1370). The message suggests the helper props for a small, uppercase,
|
|
360
|
+
* semibold label, or a `.heading` rule of the app's own.
|
|
361
|
+
*/
|
|
362
|
+
export function flagDroppedHeading(ctx, path, tag) {
|
|
363
|
+
addTodo(ctx, path, 'component:Heading', `Bulma v1 dropped the \`.heading\` styles, so the \`heading\` class on this plain <${tag}> styles nothing; restyle it with bestax helpers (e.g. \`<Paragraph textSize="7" textTransform="uppercase" textWeight="semibold" mb="1">\`) or a \`.heading\` rule of your own`);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The bestax components that render one way inside a `Field` and another
|
|
367
|
+
* outside one: each reads `useInsideField`, and most render a `Field` of
|
|
368
|
+
* their own outside one. A `Fieldset` starts a Field scope of its own, so
|
|
369
|
+
* one of these placed straight in it renders the outside way. The
|
|
370
|
+
* `field-scoped` test holds this to the library's form components.
|
|
371
|
+
*/
|
|
372
|
+
export const FIELD_SCOPED = new Set([
|
|
373
|
+
'Autocomplete',
|
|
374
|
+
'Checkboxes',
|
|
375
|
+
'ColorInput',
|
|
376
|
+
'ColorPicker',
|
|
377
|
+
'Combobox',
|
|
378
|
+
'DateInput',
|
|
379
|
+
'DateRangeInput',
|
|
380
|
+
'DateTimeInput',
|
|
381
|
+
'Dropzone',
|
|
382
|
+
'File',
|
|
383
|
+
'Input',
|
|
384
|
+
'Numberinput',
|
|
385
|
+
'PinInput',
|
|
386
|
+
'Radios',
|
|
387
|
+
'Rate',
|
|
388
|
+
'Select',
|
|
389
|
+
'Slider',
|
|
390
|
+
'Taginput',
|
|
391
|
+
'TextArea',
|
|
392
|
+
'TimeInput',
|
|
393
|
+
]);
|
|
352
394
|
/**
|
|
353
395
|
* The two structural rewrites every source needs, bound to that source's own
|
|
354
396
|
* attribute strip (its modifier vocabulary is the one thing that differs):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAUL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAoqC9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAQf;AAED,eAAO,MAAM,aAAa,UAAwB,CAAC"}
|
|
@@ -15,7 +15,7 @@ import { addAttr, attrSource, addTodo, attributesOf, findAttr, literalValueOf, m
|
|
|
15
15
|
import { applyPropAction } from '../_shared/props.js';
|
|
16
16
|
import { aTag } from '../_shared/articles.js';
|
|
17
17
|
import { AS_UNIONS } from '../_shared/polymorphic.js';
|
|
18
|
-
import { applyIconProps, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
18
|
+
import { applyIconProps, flagDroppedHeading, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
19
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
20
|
const stripModifierProps = makeStripModifierProps(UNIVERSAL_PROPS, RESPONSIVE_PROPS);
|
|
21
21
|
/**
|
|
@@ -328,8 +328,8 @@ const SPECIALS = {
|
|
|
328
328
|
* plain element bloomer rendered, and the TODO says the styling is gone.
|
|
329
329
|
*/
|
|
330
330
|
heading(ctx, path, element) {
|
|
331
|
-
addTodo(ctx, path, 'component:Heading', 'Bulma v1 dropped the `.heading` styles, so this plain <p className="heading"> renders unstyled; restyle it with bestax helpers (e.g. `textSize="7" textTransform="uppercase" textWeight="semibold"`) or your own class');
|
|
332
331
|
const tag = plainTag(ctx, path, element, 'p', 'Heading');
|
|
332
|
+
flagDroppedHeading(ctx, path, tag);
|
|
333
333
|
return replaceWithPlain(ctx, path, element, tag, 'heading', 'Heading');
|
|
334
334
|
},
|
|
335
335
|
/**
|
|
@@ -1 +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;AAoBnE;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,EAAE,UAAe,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA4CtD,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,
|
|
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;AAoBnE;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,EAAE,UAAe,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA4CtD,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,CAytBpD,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"}
|
|
@@ -228,7 +228,9 @@ export const MAPPING = {
|
|
|
228
228
|
},
|
|
229
229
|
},
|
|
230
230
|
},
|
|
231
|
-
Heading
|
|
231
|
+
// rbx's Heading is Bulma's `.heading` label, whose styles Bulma v1 no
|
|
232
|
+
// longer ships — bestax has no component for it.
|
|
233
|
+
Heading: { status: 'partial', special: 'heading' },
|
|
232
234
|
Highlight: {
|
|
233
235
|
status: 'todo',
|
|
234
236
|
todo: `\`Highlight\` (syntax-highlighted <pre>) has no bestax equivalent; use \`<Pre>\` plus your own highlighter (${DOCS}/api/elements/pre)`,
|
|
@@ -371,10 +373,10 @@ export const MAPPING = {
|
|
|
371
373
|
Body: { status: 'mapped', target: 'Field.Body' },
|
|
372
374
|
},
|
|
373
375
|
},
|
|
374
|
-
Fieldset
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
},
|
|
376
|
+
// rbx's Fieldset is a bare <fieldset>, and bestax's `unstyled` variant is
|
|
377
|
+
// the one that draws no box, so the special adds it. Inside a Field or a
|
|
378
|
+
// Control the special keeps the plain <fieldset> instead.
|
|
379
|
+
Fieldset: { status: 'mapped', target: 'Fieldset', special: 'fieldset' },
|
|
378
380
|
File: {
|
|
379
381
|
status: 'mapped',
|
|
380
382
|
target: 'File',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAYL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAaL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAm8B9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAIf"}
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* A handler may return a `target` override for the rename step, or mark the
|
|
14
14
|
* element `replaced` when it substituted the node itself.
|
|
15
15
|
*/
|
|
16
|
-
import { BADGE_PROPS, RESPONSIVE_BREAKPOINTS, TOOLTIP_PROPS, UNIVERSAL_PROPS, } from './mapping.js';
|
|
16
|
+
import { BADGE_PROPS, RESPONSIVE_BREAKPOINTS, resolveMapping, TOOLTIP_PROPS, UNIVERSAL_PROPS, } from './mapping.js';
|
|
17
17
|
import { addAttr, addTodo, buildJsxName, attributesOf, findAttr, jsxNameParts, literalValueOf, makeAttr, plainElement, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
18
|
-
import { alignTarget, applyIconProps, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, mergeClassName, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
18
|
+
import { alignTarget, applyIconProps, FIELD_SCOPED, flagDroppedHeading, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, mergeClassName, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
19
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
20
|
const stripModifierProps = makeStripModifierProps(UNIVERSAL_PROPS, RESPONSIVE_BREAKPOINTS, 'innerRef');
|
|
21
21
|
/**
|
|
@@ -56,12 +56,55 @@ function stripHelperComponentProps(ctx, path, attrs, where) {
|
|
|
56
56
|
* tag as unknown DOM attributes — see stripHelperComponentProps).
|
|
57
57
|
*/
|
|
58
58
|
const { replaceWithPlain, collapseOntoChild } = makeStructuralHelpers((ctx, path, attrs, where) => stripHelperComponentProps(ctx, path, stripModifierProps(ctx, path, attrs, where), where));
|
|
59
|
+
/**
|
|
60
|
+
* Whether the element sits inside a Field or a Control, rbx's or bestax's,
|
|
61
|
+
* which tells the bestax inputs within whether to render a Field and a
|
|
62
|
+
* Control of their own. Each ancestor is read by binding, so a local that
|
|
63
|
+
* shadows one of them is neither.
|
|
64
|
+
*/
|
|
65
|
+
function insideFormScope(ctx, path) {
|
|
66
|
+
for (let up = path.parent; up; up = up.parent) {
|
|
67
|
+
if (up.node?.type !== 'JSXElement')
|
|
68
|
+
continue;
|
|
69
|
+
const root = ctx.resolveElement?.(up)?.parts[0];
|
|
70
|
+
if (root === 'Field' || root === 'Control')
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The bestax components among the element's own children that render one
|
|
77
|
+
* way inside a `Field` and another outside one, by the names they migrate
|
|
78
|
+
* to. A child already in a Field or a Control of its own isn't one.
|
|
79
|
+
*/
|
|
80
|
+
function fieldScopedChildren(ctx, path) {
|
|
81
|
+
const names = new Set();
|
|
82
|
+
(path.node.children ?? []).forEach((child, i) => {
|
|
83
|
+
if (child.type !== 'JSXElement')
|
|
84
|
+
return;
|
|
85
|
+
const hit = ctx.resolveElement?.(path.get('children', i));
|
|
86
|
+
if (!hit)
|
|
87
|
+
return;
|
|
88
|
+
// rbx's Select.Container folds onto the Select it holds.
|
|
89
|
+
const dotted = hit.parts.join('.');
|
|
90
|
+
const name = hit.library === 'bestax'
|
|
91
|
+
? dotted
|
|
92
|
+
: dotted === 'Select.Container'
|
|
93
|
+
? 'Select'
|
|
94
|
+
: resolveMapping(hit.parts)?.target;
|
|
95
|
+
if (name && FIELD_SCOPED.has(name))
|
|
96
|
+
names.add(name);
|
|
97
|
+
});
|
|
98
|
+
return [...names];
|
|
99
|
+
}
|
|
59
100
|
const SPECIALS = {
|
|
60
101
|
/**
|
|
61
102
|
* rbx's `Heading` is Bulma's `.heading` label (small caps), not a title —
|
|
62
|
-
* bestax has no component for it, so it becomes a plain <p
|
|
103
|
+
* bestax has no component for it, so it becomes a plain <p>, and the TODO
|
|
104
|
+
* says Bulma v1 no longer styles the class.
|
|
63
105
|
*/
|
|
64
106
|
heading(ctx, path, element) {
|
|
107
|
+
flagDroppedHeading(ctx, path, 'p');
|
|
65
108
|
return replaceWithPlain(ctx, path, element, 'p', 'heading', 'Heading');
|
|
66
109
|
},
|
|
67
110
|
/**
|
|
@@ -200,6 +243,42 @@ const SPECIALS = {
|
|
|
200
243
|
loader(ctx, path, element) {
|
|
201
244
|
return replaceWithPlain(ctx, path, element, 'div', 'loader', 'Loader');
|
|
202
245
|
},
|
|
246
|
+
/**
|
|
247
|
+
* rbx's Fieldset is a bare <fieldset>, which Bulma's base styles strip of
|
|
248
|
+
* its border, margin and padding, while bestax's Fieldset draws a bordered
|
|
249
|
+
* box unless told otherwise. `variant="unstyled"` is the one that draws no
|
|
250
|
+
* box. `disabled` carries over as it is, and bestax's also passes it to
|
|
251
|
+
* the bestax inputs inside, which a plain <fieldset> can't reach.
|
|
252
|
+
*
|
|
253
|
+
* bestax's Fieldset also starts its own Field scope, which rbx's never
|
|
254
|
+
* did. Inside a Field or a Control that changes what an input placed
|
|
255
|
+
* straight in it renders: `<Field><Fieldset><Input /></Fieldset></Field>`
|
|
256
|
+
* would gain a `.field` and a `.control` of its own. There it stays the
|
|
257
|
+
* plain <fieldset> rbx rendered, which keeps the markup and, since every
|
|
258
|
+
* input rbx had is a native one, the `disabled` behavior too.
|
|
259
|
+
*
|
|
260
|
+
* Only a Field or a Control in the same file shows, though: one in another
|
|
261
|
+
* component that renders this one is out of sight. So where an input sits
|
|
262
|
+
* straight in a Fieldset that converts, an advisory TODO says what to do
|
|
263
|
+
* if one does.
|
|
264
|
+
*/
|
|
265
|
+
fieldset(ctx, path, element) {
|
|
266
|
+
if (insideFormScope(ctx, path)) {
|
|
267
|
+
return replaceWithPlain(ctx, path, element, 'fieldset', undefined, 'Fieldset');
|
|
268
|
+
}
|
|
269
|
+
if (!findAttr(element, 'variant')) {
|
|
270
|
+
// Before any spread, so a `variant` the spread carries still wins.
|
|
271
|
+
const attrs = (element.openingElement.attributes ??= []);
|
|
272
|
+
const spread = attrs.findIndex((attr) => attr.type === 'JSXSpreadAttribute');
|
|
273
|
+
attrs.splice(spread === -1 ? attrs.length : spread, 0, makeAttr(ctx.j, 'variant', 'unstyled'));
|
|
274
|
+
ctx.dirty = true;
|
|
275
|
+
}
|
|
276
|
+
const scoped = fieldScopedChildren(ctx, path);
|
|
277
|
+
if (scoped.length > 0) {
|
|
278
|
+
addTodo(ctx, path, 'component:Fieldset', `bestax's \`Fieldset\` starts its own Field scope, so ${scoped.map(name => `\`${name}\``).join(', ')} placed straight in it renders as it does outside any \`Field\`, with a \`.field\` of its own where it has one. That's right unless another component renders this \`Fieldset\` inside a \`Field\` or a \`Control\`, which the codemod can't see from here: there, render a plain \`<fieldset>\` instead, which leaves their scope alone, as the codemod does when it can see the \`Field\``);
|
|
279
|
+
}
|
|
280
|
+
return {};
|
|
281
|
+
},
|
|
203
282
|
/** rbx's full-screen PageLoader is bestax's Loading with isFullPage. */
|
|
204
283
|
'page-loader'(ctx, _path, element) {
|
|
205
284
|
if (!findAttr(element, 'isFullPage')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoDvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAu+BpB"}
|
|
@@ -23,7 +23,7 @@ import { BADGE_PROPS, MAPPING, TOOLTIP_PROPS, UNIVERSAL_PROPS, resolveMapping, }
|
|
|
23
23
|
import { addTodo, attributesOf, findAttr, forgetJsxParens, jsxNameParts, literalValueOf, removeAttr, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
24
24
|
import { applyPropAction, applyUniversalProps } from '../_shared/props.js';
|
|
25
25
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
26
|
-
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
26
|
+
import { BESTAX, bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
27
27
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
28
28
|
import { collectBoundNames, makeAliasRegistry, makeReserve, nameOf, prefersTabs, resolvesToBinding, } from '../_shared/imports.js';
|
|
29
29
|
import { flattenResponsiveProps, RESPONSIVE_KINDS } from './responsive.js';
|
|
@@ -236,6 +236,47 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
236
236
|
return [imported, ...rest];
|
|
237
237
|
}
|
|
238
238
|
ctx.resolve = resolveJsxPath;
|
|
239
|
+
// The locals of `import * as Bulma from '@allxsmith/bestax-bulma'`.
|
|
240
|
+
const bestaxNamespaces = new Set();
|
|
241
|
+
root
|
|
242
|
+
.find(j.ImportDeclaration, { source: { value: BESTAX } })
|
|
243
|
+
.forEach(path => {
|
|
244
|
+
for (const spec of path.node.specifiers ?? []) {
|
|
245
|
+
if (spec.type === 'ImportNamespaceSpecifier' && spec.local) {
|
|
246
|
+
bestaxNamespaces.add(nameOf(spec.local));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* What the element at `path` renders, by binding. An rbx name resolves as
|
|
252
|
+
* the JSX pass resolves it. Elements are migrated parents first, so an
|
|
253
|
+
* ancestor of the element being migrated may already carry its bestax
|
|
254
|
+
* name: a bestax local, the file's own import or one `ctx.reserve` chose.
|
|
255
|
+
* A name `ctx.reserve` chose is declared nowhere yet and the file's own
|
|
256
|
+
* import at the top, so any nearer binding of the name shadows it.
|
|
257
|
+
*/
|
|
258
|
+
ctx.resolveElement = (path) => {
|
|
259
|
+
const name = path.node?.openingElement?.name;
|
|
260
|
+
const parts = jsxNameParts(name);
|
|
261
|
+
if (!parts)
|
|
262
|
+
return null;
|
|
263
|
+
const [head, ...rest] = parts;
|
|
264
|
+
const rbxPath = resolveJsxPath(name, path);
|
|
265
|
+
if (rbxPath &&
|
|
266
|
+
resolvesToBinding(path, head, anyAlias(head) ? undefined : programScope)) {
|
|
267
|
+
return { library: 'source', parts: rbxPath };
|
|
268
|
+
}
|
|
269
|
+
if (!resolvesToBinding(path, head, programScope))
|
|
270
|
+
return null;
|
|
271
|
+
if (bestaxNamespaces.has(head)) {
|
|
272
|
+
return rest.length > 0 ? { library: 'bestax', parts: rest } : null;
|
|
273
|
+
}
|
|
274
|
+
for (const [imported, local] of ctx.needed) {
|
|
275
|
+
if (local === head)
|
|
276
|
+
return { library: 'bestax', parts: [imported, ...rest] };
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
};
|
|
239
280
|
// ---- 1c. Collect local bindings so new imports never collide -----------
|
|
240
281
|
const bound = collectBoundNames(j, root, RBX);
|
|
241
282
|
// Seed the reserved set with the local names of rbx imports that CANNOT be
|
|
@@ -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,EAWL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,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,yBAAyB,CAAC;AAEjC,OAAO,EAUL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAy3B9B,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"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { RESPONSIVE_BREAKPOINTS, UNIVERSAL_PROPS } from './mapping.js';
|
|
11
11
|
import { addAttr, addTodo, attributesOf, buildJsxName, findAttr, literalValueOf, makeAttr, plainElement, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
12
12
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
13
|
-
import { alignTarget, dropLinkAttrsForPlainTag, keepTitleLevel, makeStripModifierProps, mergeClassName, applyIconProps, parseIconClasses, } from '../_shared/specials-utils.js';
|
|
13
|
+
import { alignTarget, dropLinkAttrsForPlainTag, flagDroppedHeading, keepTitleLevel, makeStripModifierProps, mergeClassName, applyIconProps, parseIconClasses, } from '../_shared/specials-utils.js';
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
15
|
/**
|
|
16
16
|
* The attributes a plain-element rewrite keeps: the modifier strip decides
|
|
@@ -139,6 +139,7 @@ const SPECIALS = {
|
|
|
139
139
|
// independently, so it rides along on the paragraph as `heading subtitle`
|
|
140
140
|
// (dropping it would be the same silent loss the dynamic guard prevents).
|
|
141
141
|
if (headingTruthy && !subtitleDynamic) {
|
|
142
|
+
flagDroppedHeading(ctx, path, 'p');
|
|
142
143
|
removeAttr(element, headingAttr);
|
|
143
144
|
const className = mergeClassName(ctx, path, element, subtitleTruthy ? 'heading subtitle' : 'heading', 'Heading');
|
|
144
145
|
// The seventh hand-built plain rewrite in this file, and the one that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.0",
|
|
4
4
|
"description": "Codemods for migrating existing React apps from other Bulma libraries to @allxsmith/bestax-bulma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,28 +34,26 @@
|
|
|
34
34
|
"url": "https://github.com/allxsmith/bestax/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/parser": "^7.29.
|
|
37
|
+
"@babel/parser": "^7.29.11",
|
|
38
38
|
"chalk": "^6.0.1",
|
|
39
39
|
"commander": "^15.0.0",
|
|
40
40
|
"jscodeshift": "^17.3.0",
|
|
41
|
-
"parse5": "^
|
|
41
|
+
"parse5": "^8.0.1",
|
|
42
42
|
"property-information": "^7.2.0",
|
|
43
|
-
"@allxsmith/bestax-bulma": "^5.57.
|
|
43
|
+
"@allxsmith/bestax-bulma": "^5.57.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@jest/globals": "^30.0.0",
|
|
47
|
-
"@types/jest": "^30.0.0",
|
|
48
46
|
"@types/jscodeshift": "^17.3.0",
|
|
49
|
-
"@types/node": "^26.6.
|
|
47
|
+
"@types/node": "^26.6.6",
|
|
50
48
|
"@types/react": "^19.3.0",
|
|
51
49
|
"@types/react-dom": "^19.3.0",
|
|
50
|
+
"@vitest/coverage-istanbul": "^5.0.5",
|
|
52
51
|
"classnames": "^2.5.1",
|
|
53
52
|
"clsx": "^2.1.1",
|
|
54
|
-
"jest": "^30.2.0",
|
|
55
53
|
"react": "^19.3.1",
|
|
56
54
|
"react-dom": "^19.3.1",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
55
|
+
"typescript": "^6.0.3",
|
|
56
|
+
"vitest": "^5.0.5"
|
|
59
57
|
},
|
|
60
58
|
"publishConfig": {
|
|
61
59
|
"access": "public"
|
|
@@ -63,9 +61,9 @@
|
|
|
63
61
|
"scripts": {
|
|
64
62
|
"build": "tsc",
|
|
65
63
|
"dev": "tsc --watch",
|
|
66
|
-
"test": "
|
|
67
|
-
"test:watch": "
|
|
68
|
-
"test:coverage": "
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"test:coverage": "vitest run --coverage",
|
|
69
67
|
"lint": "eslint src e2e",
|
|
70
68
|
"typecheck": "tsc --noEmit",
|
|
71
69
|
"validate:corpus": "pnpm run build && node scripts/validate-corpus.mjs",
|