bestax-migrate 2.21.1 → 2.22.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/bulma-classes/class-map.d.ts +28 -0
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +33 -2
- package/dist/sources/bulma-classes/plan.d.ts +19 -0
- package/dist/sources/bulma-classes/plan.d.ts.map +1 -1
- package/dist/sources/bulma-classes/plan.js +37 -5
- package/dist/sources/bulma-classes/transform.d.ts.map +1 -1
- package/dist/sources/bulma-classes/transform.js +41 -0
- package/package.json +1 -1
|
@@ -35,6 +35,15 @@ export interface Modifier {
|
|
|
35
35
|
* handed to the prop as it is.
|
|
36
36
|
*/
|
|
37
37
|
readonly onlyTrue?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The prop renders this attribute too, unless the element sets its own
|
|
40
|
+
* (`Pagination.Link`'s `active` and `aria-current`), so the class converts
|
|
41
|
+
* only beside one written out, and stays a class otherwise.
|
|
42
|
+
*/
|
|
43
|
+
readonly needsAttr?: {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly value: string;
|
|
46
|
+
};
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* - `mapped`: converts to `target`.
|
|
@@ -203,6 +212,25 @@ export interface RootEntry {
|
|
|
203
212
|
readonly folds?: readonly PropWrite[];
|
|
204
213
|
/** The target renders the element's only child itself. */
|
|
205
214
|
readonly absorbs?: Absorbs;
|
|
215
|
+
/**
|
|
216
|
+
* The target renders a bare `<tag>` around the element too
|
|
217
|
+
* (`Pagination.Link`'s `<li>`), so the element converts only as the only
|
|
218
|
+
* child of a bare one, which it takes the place of.
|
|
219
|
+
*/
|
|
220
|
+
readonly parent?: {
|
|
221
|
+
readonly tag: string;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* The target renders this text as its content, whatever it's given
|
|
225
|
+
* (`Pagination.Ellipsis`' `…`), so the element converts only holding
|
|
226
|
+
* exactly it, and closes itself.
|
|
227
|
+
*/
|
|
228
|
+
readonly rendersText?: string;
|
|
229
|
+
/**
|
|
230
|
+
* The target writes a given `className` in place of its own class, so the
|
|
231
|
+
* element converts only with no other class.
|
|
232
|
+
*/
|
|
233
|
+
readonly classNameReplaces?: boolean;
|
|
206
234
|
/** Props the target needs to render this class at all (`variant="lines"`). */
|
|
207
235
|
readonly writes?: readonly PropWrite[];
|
|
208
236
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,MAAM,GAChB;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE9E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;G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,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAiBD,qCAAqC;AACrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE5D;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE7D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAGlE;AAED,qCAAqC;AACrC,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,GACZ,QAAQ,GAAG,SAAS,CAEtB;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D"}
|
|
@@ -1491,8 +1491,39 @@ export const ROOTS = {
|
|
|
1491
1491
|
},
|
|
1492
1492
|
ownProps: ['disabled'],
|
|
1493
1493
|
},
|
|
1494
|
-
|
|
1495
|
-
|
|
1494
|
+
// A page link and the ellipsis each render the bare `<li>` around them, so
|
|
1495
|
+
// each converts in its `<li>`'s place. A link writes `tabIndex` before the
|
|
1496
|
+
// props it's given, and `active` writes `aria-current="page"` the same way.
|
|
1497
|
+
'pagination-link': {
|
|
1498
|
+
...BASE,
|
|
1499
|
+
target: 'Pagination.Link',
|
|
1500
|
+
tag: 'a',
|
|
1501
|
+
parent: { tag: 'li' },
|
|
1502
|
+
modifiers: {
|
|
1503
|
+
'is-current': {
|
|
1504
|
+
writes: [{ prop: 'active' }],
|
|
1505
|
+
needsAttr: { name: 'aria-current', value: 'page' },
|
|
1506
|
+
},
|
|
1507
|
+
},
|
|
1508
|
+
defaults: { tabIndex: '0' },
|
|
1509
|
+
omits: {
|
|
1510
|
+
'is-disabled': '`disabled` also writes `aria-disabled` and `tabIndex="-1"`',
|
|
1511
|
+
},
|
|
1512
|
+
ownProps: ['color', 'textColor', 'bgColor', 'active', 'disabled'],
|
|
1513
|
+
},
|
|
1514
|
+
// It renders its own `…`, and a `className` it's given replaces its class.
|
|
1515
|
+
'pagination-ellipsis': {
|
|
1516
|
+
status: 'mapped',
|
|
1517
|
+
target: 'Pagination.Ellipsis',
|
|
1518
|
+
tag: 'span',
|
|
1519
|
+
textColor: null,
|
|
1520
|
+
bgColor: null,
|
|
1521
|
+
noHelpers: true,
|
|
1522
|
+
parent: { tag: 'li' },
|
|
1523
|
+
rendersText: '\u2026',
|
|
1524
|
+
classNameReplaces: true,
|
|
1525
|
+
ownProps: [],
|
|
1526
|
+
},
|
|
1496
1527
|
// `Panel`'s `color` renders `has-text-<color>` as well as `is-<color>`, and it
|
|
1497
1528
|
// has no text or background color prop. Its heading, tabs and block are
|
|
1498
1529
|
// plain elements with their class, and take no helper props.
|
|
@@ -88,6 +88,20 @@ export interface ElementFacts {
|
|
|
88
88
|
* (`tokens` is empty either way).
|
|
89
89
|
*/
|
|
90
90
|
emptyClass?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The plain HTML element around this one, when this is its only child:
|
|
93
|
+
* what an entry whose target renders that element too reads.
|
|
94
|
+
*/
|
|
95
|
+
soleChildOf?: ChildFacts;
|
|
96
|
+
/**
|
|
97
|
+
* The component that element is the only child of, if any: `onlyChildOf`
|
|
98
|
+
* for the element such an entry takes the place of.
|
|
99
|
+
*/
|
|
100
|
+
holderOnlyChildOf?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The string the element's content renders, when it is one static text.
|
|
103
|
+
*/
|
|
104
|
+
text?: string;
|
|
91
105
|
}
|
|
92
106
|
export interface ChildFacts {
|
|
93
107
|
tag: string;
|
|
@@ -149,6 +163,11 @@ export interface Conversion {
|
|
|
149
163
|
* they go, and the element closes itself.
|
|
150
164
|
*/
|
|
151
165
|
rendersChildren?: true;
|
|
166
|
+
/**
|
|
167
|
+
* The target renders the bare element around this one too: the component
|
|
168
|
+
* takes that element's place, with its `key`.
|
|
169
|
+
*/
|
|
170
|
+
replacesParent?: true;
|
|
152
171
|
/**
|
|
153
172
|
* Conditional classes (`ElementFacts.conditional`) that become a boolean
|
|
154
173
|
* prop set to their condition, each once. The rest stay in the joiner call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAmBH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,qEAAqE;IACrE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,qEAAqE;IACrE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;I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C,CAAC;QACnD,4DAA4D;QAC5D,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3C,qDAAqD;QACrD,IAAI,EAAE,MAAM,EAAE,CAAC;QACf;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QACnD,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AA+BD,wBAAgB,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA6d9C"}
|
|
@@ -99,7 +99,8 @@ export function plan(facts) {
|
|
|
99
99
|
// A wrapper exists only to carry helper props, so a tag none of whose
|
|
100
100
|
// classes becomes one stays as it is, and nothing else about it is worth
|
|
101
101
|
// a TODO.
|
|
102
|
-
if (propsFrom(entry, tokens, tag, undefined).writes.size ===
|
|
102
|
+
if (propsFrom(entry, tokens, tag, undefined, facts.attributes).writes.size ===
|
|
103
|
+
0) {
|
|
103
104
|
return { conversion: null, todos };
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -118,6 +119,26 @@ export function plan(facts) {
|
|
|
118
119
|
if (facts.onlyChildOf) {
|
|
119
120
|
return refuse('only-child', target, `this element is the only child of \`<${facts.onlyChildOf}>\`, which may hand it props or a ref with \`cloneElement\` (next/link's legacy behavior, a tooltip, a Radix \`asChild\` trigger) that bestax \`${target}\` would not take the same way; convert it by hand if \`<${facts.onlyChildOf}>\` only renders its children`);
|
|
120
121
|
}
|
|
122
|
+
const parent = entry.parent;
|
|
123
|
+
if (parent) {
|
|
124
|
+
const holder = facts.soleChildOf;
|
|
125
|
+
const bare = holder?.tag === parent.tag &&
|
|
126
|
+
holder.tokens === undefined &&
|
|
127
|
+
!holder.hasSpread &&
|
|
128
|
+
[...holder.attributes.keys()].every(name => name === 'key');
|
|
129
|
+
if (!bare) {
|
|
130
|
+
return refuse('context', target, `bestax \`${target}\` renders its own bare <${parent.tag}> around the <${tag}>, so this converts only as the only thing inside a bare <${parent.tag}>, which it takes the place of; keep it as markup`);
|
|
131
|
+
}
|
|
132
|
+
if (facts.holderOnlyChildOf) {
|
|
133
|
+
return refuse('only-child', target, `the <${parent.tag}> around this element is the only child of \`<${facts.holderOnlyChildOf}>\`, which may hand it props or a ref with \`cloneElement\`, and bestax \`${target}\` in its place would put them on the <${tag}>; convert it by hand if \`<${facts.holderOnlyChildOf}>\` only renders its children`);
|
|
134
|
+
}
|
|
135
|
+
if (holder.attributes.has('key') && facts.attributes.has('key')) {
|
|
136
|
+
return refuse('attr', 'key', `bestax \`${target}\` takes the place of the <${parent.tag}> around this element, and both have a \`key\`; keep one, then re-run`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (entry.rendersText !== undefined && facts.text !== entry.rendersText) {
|
|
140
|
+
return refuse('children', target, `bestax \`${target}\` renders its own \`${entry.rendersText}\` as its content, so this converts only holding exactly that; keep it as markup`);
|
|
141
|
+
}
|
|
121
142
|
// An element converts with no class left only when found by where it sits,
|
|
122
143
|
// and then an empty `className` would go with nothing to render it.
|
|
123
144
|
if (placed && facts.emptyClass) {
|
|
@@ -274,7 +295,7 @@ export function plan(facts) {
|
|
|
274
295
|
}
|
|
275
296
|
}
|
|
276
297
|
// ---- Tokens → props ---------------------------------------------------------
|
|
277
|
-
const fromTokens = propsFrom(entry, tokens, tag, root);
|
|
298
|
+
const fromTokens = propsFrom(entry, tokens, tag, root, attributes);
|
|
278
299
|
const { writes, converted } = fromTokens;
|
|
279
300
|
numbers.push(...fromTokens.numbers);
|
|
280
301
|
// ---- The tag ------------------------------------------------------------
|
|
@@ -324,6 +345,7 @@ export function plan(facts) {
|
|
|
324
345
|
write.value === undefined &&
|
|
325
346
|
!modifier.onlyTrue &&
|
|
326
347
|
(!modifier.tagIn || modifier.tagIn.includes(tag)) &&
|
|
348
|
+
(!modifier.needsAttr || attributes.has(modifier.needsAttr.name)) &&
|
|
327
349
|
!writes.has(write.prop) &&
|
|
328
350
|
!conditional.some(([prop]) => prop === write.prop);
|
|
329
351
|
// Written as a prop, the condition is evaluated before any left in the
|
|
@@ -339,6 +361,9 @@ export function plan(facts) {
|
|
|
339
361
|
}
|
|
340
362
|
});
|
|
341
363
|
const rest = tokens.filter(token => !converted.has(token));
|
|
364
|
+
if (entry.classNameReplaces && (rest.length > 0 || conditionalStays)) {
|
|
365
|
+
return refuse('attr', 'className', `bestax \`${target}\` writes a \`className\` it's given in place of \`.${root}\`, so this converts only with no other class; keep it as markup`);
|
|
366
|
+
}
|
|
342
367
|
return {
|
|
343
368
|
conversion: {
|
|
344
369
|
target,
|
|
@@ -347,7 +372,10 @@ export function plan(facts) {
|
|
|
347
372
|
drop,
|
|
348
373
|
numbers,
|
|
349
374
|
...(absorbed ? { absorbs: absorbed } : {}),
|
|
350
|
-
...(counts
|
|
375
|
+
...(counts || entry.rendersText !== undefined
|
|
376
|
+
? { rendersChildren: true }
|
|
377
|
+
: {}),
|
|
378
|
+
...(parent ? { replacesParent: true } : {}),
|
|
351
379
|
...(conditional.length > 0 ? { conditional } : {}),
|
|
352
380
|
},
|
|
353
381
|
todos,
|
|
@@ -358,9 +386,10 @@ export function plan(facts) {
|
|
|
358
386
|
* write, the classes that leave `className`, and the props written as
|
|
359
387
|
* numbers. The group rules apply, so a helper the target would drop (a
|
|
360
388
|
* base `display` beside a per-viewport one, a flex-container helper with no
|
|
361
|
-
* flex `display`) stays a class
|
|
389
|
+
* flex `display`) stays a class, and so does a modifier missing the
|
|
390
|
+
* attribute it needs.
|
|
362
391
|
*/
|
|
363
|
-
function propsFrom(entry, tokens, tag, root) {
|
|
392
|
+
function propsFrom(entry, tokens, tag, root, attributes) {
|
|
364
393
|
const numbers = [];
|
|
365
394
|
// What the root itself needs comes first, so no class can take its prop.
|
|
366
395
|
const writes = new Map((entry.writes ?? []).map(write => [write.prop, write.value ?? true]));
|
|
@@ -375,6 +404,9 @@ function propsFrom(entry, tokens, tag, root) {
|
|
|
375
404
|
if (modifier) {
|
|
376
405
|
if (modifier.tagIn && !modifier.tagIn.includes(tag))
|
|
377
406
|
continue;
|
|
407
|
+
if (modifier.needsAttr && !attributes.has(modifier.needsAttr.name)) {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
378
410
|
if (modifier.writes.some(write => writes.has(write.prop)))
|
|
379
411
|
continue;
|
|
380
412
|
for (const write of modifier.writes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAyyBvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAgqBpB"}
|
|
@@ -615,6 +615,13 @@ function isMapCall(call) {
|
|
|
615
615
|
!callee.computed &&
|
|
616
616
|
(callee.property?.name === 'map' || callee.property?.name === 'flatMap'));
|
|
617
617
|
}
|
|
618
|
+
/** The string an element's content renders, when it is one static text. */
|
|
619
|
+
function textOf(element) {
|
|
620
|
+
const content = (element.children ?? []).filter((child) => !dropped(child));
|
|
621
|
+
return content.length === 1 && content[0].type === 'JSXText'
|
|
622
|
+
? jsxTextRenders(content[0].value)
|
|
623
|
+
: undefined;
|
|
624
|
+
}
|
|
618
625
|
/** Whitespace React drops, which nothing is lost with. A comment is kept. */
|
|
619
626
|
function dropped(child) {
|
|
620
627
|
return child.type === 'JSXText' && !reachesReact(child);
|
|
@@ -887,6 +894,13 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
887
894
|
? root
|
|
888
895
|
: undefined;
|
|
889
896
|
};
|
|
897
|
+
/** The element directly around this one, when this is its only child. */
|
|
898
|
+
const holderOf = (elementPath) => {
|
|
899
|
+
const up = elementPath.parent?.node;
|
|
900
|
+
return up?.type === 'JSXElement' && soleChild(up) === elementPath.node
|
|
901
|
+
? up
|
|
902
|
+
: undefined;
|
|
903
|
+
};
|
|
890
904
|
// `converts` is whether the element would become a component with its
|
|
891
905
|
// classes written out, so it holds for a computed className too.
|
|
892
906
|
const elements = [];
|
|
@@ -927,6 +941,11 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
927
941
|
onlyChildOf: onlyChildOf(elementPath, bestaxLocals),
|
|
928
942
|
...(item && { itemOf: item }),
|
|
929
943
|
...(classAttr && className?.trim() === '' && { emptyClass: true }),
|
|
944
|
+
...(holderOf(elementPath) && {
|
|
945
|
+
soleChildOf: childFacts(holderOf(elementPath)),
|
|
946
|
+
holderOnlyChildOf: onlyChildOf(elementPath.parent, bestaxLocals),
|
|
947
|
+
}),
|
|
948
|
+
...(textOf(element) !== undefined && { text: textOf(element) }),
|
|
930
949
|
};
|
|
931
950
|
// A joiner call the codemod can read converts exactly: its fixed classes
|
|
932
951
|
// as for a static className, and each condition on a flag as its prop.
|
|
@@ -1207,6 +1226,28 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
1207
1226
|
continue;
|
|
1208
1227
|
attr.value = j.jsxExpressionContainer(j.numericLiteral(Number(attributeValue(attr))));
|
|
1209
1228
|
}
|
|
1229
|
+
if (conversion.replacesParent) {
|
|
1230
|
+
// The component renders the element around this one too, so it takes
|
|
1231
|
+
// that one's place, with its `key` and its comments.
|
|
1232
|
+
const holderPath = elementPath.parent;
|
|
1233
|
+
const holder = holderPath.node;
|
|
1234
|
+
const key = findAttr(holder, 'key');
|
|
1235
|
+
if (key) {
|
|
1236
|
+
written.openingElement.attributes = [
|
|
1237
|
+
key,
|
|
1238
|
+
...(written.openingElement.attributes ?? []),
|
|
1239
|
+
];
|
|
1240
|
+
}
|
|
1241
|
+
const inTags = tagComments(holder);
|
|
1242
|
+
if (inTags.length) {
|
|
1243
|
+
const name = written.openingElement.name;
|
|
1244
|
+
name.comments = [...(name.comments ?? []), ...inTags.map(afterTagName)];
|
|
1245
|
+
}
|
|
1246
|
+
if (holder.comments?.length) {
|
|
1247
|
+
written.comments = [...holder.comments, ...(written.comments ?? [])];
|
|
1248
|
+
}
|
|
1249
|
+
holderPath.replace(written);
|
|
1250
|
+
}
|
|
1210
1251
|
ctx.dirty = true;
|
|
1211
1252
|
}
|
|
1212
1253
|
// A joiner import only these rewrites stopped using goes too, so the file
|