bestax-migrate 2.40.1 → 2.41.1

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/sources/_shared/bestax-floor.d.ts +49 -0
  3. package/dist/sources/_shared/bestax-floor.d.ts.map +1 -1
  4. package/dist/sources/_shared/bestax-floor.js +84 -0
  5. package/dist/sources/_shared/bestax-import.d.ts +16 -1
  6. package/dist/sources/_shared/bestax-import.d.ts.map +1 -1
  7. package/dist/sources/_shared/bestax-import.js +67 -2
  8. package/dist/sources/_shared/bestax-release.d.ts +27 -0
  9. package/dist/sources/_shared/bestax-release.d.ts.map +1 -0
  10. package/dist/sources/_shared/bestax-release.js +79 -0
  11. package/dist/sources/_shared/deps-common.d.ts +11 -9
  12. package/dist/sources/_shared/deps-common.d.ts.map +1 -1
  13. package/dist/sources/_shared/deps-common.js +25 -11
  14. package/dist/sources/_shared/imports.d.ts +50 -1
  15. package/dist/sources/_shared/imports.d.ts.map +1 -1
  16. package/dist/sources/_shared/imports.js +121 -0
  17. package/dist/sources/_shared/jsx-utils.d.ts +8 -0
  18. package/dist/sources/_shared/jsx-utils.d.ts.map +1 -1
  19. package/dist/sources/_shared/jsx-utils.js +13 -0
  20. package/dist/sources/_shared/props.d.ts +13 -0
  21. package/dist/sources/_shared/props.d.ts.map +1 -1
  22. package/dist/sources/_shared/props.js +36 -0
  23. package/dist/sources/bloomer/deps.d.ts +2 -3
  24. package/dist/sources/bloomer/deps.d.ts.map +1 -1
  25. package/dist/sources/bloomer/deps.js +9 -9
  26. package/dist/sources/bloomer/mapping.d.ts +3 -22
  27. package/dist/sources/bloomer/mapping.d.ts.map +1 -1
  28. package/dist/sources/bloomer/mapping.js +5 -45
  29. package/dist/sources/bloomer/transform.d.ts +3 -2
  30. package/dist/sources/bloomer/transform.d.ts.map +1 -1
  31. package/dist/sources/bloomer/transform.js +50 -39
  32. package/dist/sources/bulma-classes/deps.d.ts +2 -2
  33. package/dist/sources/bulma-classes/deps.js +2 -2
  34. package/dist/sources/rbx/deps.d.ts +2 -3
  35. package/dist/sources/rbx/deps.d.ts.map +1 -1
  36. package/dist/sources/rbx/deps.js +9 -9
  37. package/dist/sources/rbx/index.d.ts.map +1 -1
  38. package/dist/sources/rbx/index.js +6 -0
  39. package/dist/sources/rbx/mapping.d.ts +8 -0
  40. package/dist/sources/rbx/mapping.d.ts.map +1 -1
  41. package/dist/sources/rbx/mapping.js +53 -0
  42. package/dist/sources/rbx/transform.d.ts +3 -2
  43. package/dist/sources/rbx/transform.d.ts.map +1 -1
  44. package/dist/sources/rbx/transform.js +162 -72
  45. package/dist/sources/react-bulma-components/deps.d.ts +2 -2
  46. package/dist/sources/react-bulma-components/deps.d.ts.map +1 -1
  47. package/dist/sources/react-bulma-components/deps.js +10 -9
  48. package/dist/sources/react-bulma-components/transform.d.ts +3 -2
  49. package/dist/sources/react-bulma-components/transform.d.ts.map +1 -1
  50. package/dist/sources/react-bulma-components/transform.js +46 -63
  51. package/dist/types.d.ts +4 -3
  52. package/dist/types.d.ts.map +1 -1
  53. package/package.json +6 -6
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * package.json migration: swap react-bulma-components for
3
3
  * @allxsmith/bestax-bulma, move Bulma to v1, and replace the dead node-sass
4
- * with dart-sass. Pure data-in/data-out — the CLI owns file IO, and no
5
- * package manager is ever invoked (the report tells the user to install).
4
+ * with dart-sass. No package manager is ever invoked (the report tells the
5
+ * user to install).
6
6
  */
7
7
  import { DEP_SECTIONS, addBestax, moveBulmaToV1, openManifest, replaceNodeSass, reportPeerRanges, } from '../_shared/deps-common.js';
8
8
  export const updateDependencies = (filePath, pkg, collector, options) => {
@@ -17,14 +17,15 @@ export const updateDependencies = (filePath, pkg, collector, options) => {
17
17
  manifest.note(`removed react-bulma-components from ${name}`);
18
18
  }
19
19
  }
20
- // The transform deliberately RETAINS imports for components with no bestax
21
- // equivalent (Element, Tile) so a partially migrated app still runs.
22
- // Removing the package from the manifest strands exactly those imports once
23
- // the user runs the install the report asks for, so say so rather than
24
- // letting them find out at build time. rbx has carried this warning since
25
- // it shipped; this source retains imports the same way and did not.
20
+ // Files can still import the library after the run: a trimmed import the
21
+ // transform kept, so a partially migrated app still runs, one it couldn't
22
+ // rewrite, a file it couldn't parse or doesn't read (`.vue`, `.astro`).
23
+ // Removing the package from the manifest strands those imports once the
24
+ // user runs the install the report asks for, so say so rather than letting
25
+ // them find out at build time. rbx has carried this warning since it
26
+ // shipped; this source retains imports the same way and did not.
26
27
  if (removedSource && options.sourceStillImported) {
27
- manifest.report('deps', 'react-bulma-components 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 react-bulma-components until you have');
28
+ manifest.report('deps', 'react-bulma-components was removed from package.json, but some files still import it, and installing would leave those imports unresolved: migrate every remaining import of react-bulma-components (the ones the codemod kept are marked `TODO(bestax-migrate)`) before installing, or re-add react-bulma-components until you have');
28
29
  }
29
30
  addBestax(manifest);
30
31
  moveBulmaToV1(manifest, options.bulmaReferenced);
@@ -7,8 +7,9 @@
7
7
  * 2. per-element: structural special → rename → responsive flattening →
8
8
  * component prop map → universal modifier props
9
9
  * 3. rewrite imports: drop RBC, add one merged bestax-bulma import; keep a
10
- * trimmed RBC import (with a TODO) only for components that have no
11
- * bestax equivalent (Element, Tile)
10
+ * trimmed RBC import (with a TODO) only for what another TODO left
11
+ * using it, such as a component with no bestax equivalent (Element,
12
+ * Tile)
12
13
  *
13
14
  * Anything unsafe gets a `// TODO(bestax-migrate)` comment on the enclosing
14
15
  * statement plus an entry in the run report.
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAyCvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAuxBpB"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgDvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CA0vBpB"}
@@ -7,23 +7,24 @@
7
7
  * 2. per-element: structural special → rename → responsive flattening →
8
8
  * component prop map → universal modifier props
9
9
  * 3. rewrite imports: drop RBC, add one merged bestax-bulma import; keep a
10
- * trimmed RBC import (with a TODO) only for components that have no
11
- * bestax equivalent (Element, Tile)
10
+ * trimmed RBC import (with a TODO) only for what another TODO left
11
+ * using it, such as a component with no bestax equivalent (Element,
12
+ * Tile)
12
13
  *
13
14
  * Anything unsafe gets a `// TODO(bestax-migrate)` comment on the enclosing
14
15
  * statement plus an entry in the run report.
15
16
  */
16
17
  import { MAPPING, UNIVERSAL_PROPS, resolveMapping } from './mapping.js';
17
- import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
18
+ import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, renameElement, replaceChain, reprintDirectives, } from '../_shared/jsx-utils.js';
18
19
  import { applyBackgroundColor } from '../_shared/background-props.js';
19
20
  import { applyPropAction, applyUniversalProps } from '../_shared/props.js';
20
21
  import { applyTextColor } from '../_shared/text-color-props.js';
21
22
  import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
22
23
  import { keepBaseDisplay } from '../_shared/display.js';
23
24
  import { askForModalName } from '../_shared/modal-name.js';
24
- import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
25
+ import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, noteRetainedImport, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
25
26
  import { rewriteStylesheetImports } from '../_shared/css-imports.js';
26
- import { collectBoundNames, makeAliasRegistry, makeReserve, nameOf, prefersTabs, resolvesToBinding, } from '../_shared/imports.js';
27
+ import { collectBoundNames, flatReExportTarget, keptForExport, makeAliasRegistry, makeDestructuringPlan, makeReserve, nameOf, namesNoLocal, prefersTabs, reExportedLocals, resolvesToBinding, } from '../_shared/imports.js';
27
28
  import { applyColorVariant } from './color-variant.js';
28
29
  import { flattenResponsiveProps } from './responsive.js';
29
30
  import { RESPONSIVE_KINDS, runSpecial } from './specials.js';
@@ -108,34 +109,21 @@ export default function transform(fileInfo, api, options = {}) {
108
109
  // against the binding it actually resolves to rather than matched by name.
109
110
  const programScope = root.find(j.Program).paths()[0]?.scope;
110
111
  const { register: registerAlias, aliasAt, anyAlias } = makeAliasRegistry();
111
- /**
112
- * Locals a re-export names. Pruning the declaration that binds one of them
113
- * (`const { Header } = Card; export { Header };`) leaves the specifier
114
- * pointing at nothing, so those declarations are kept: the value-reference
115
- * pass rewrites their initialiser to the bestax component, and the export
116
- * goes on re-exporting the same member.
117
- */
118
- const reExported = new Set();
119
- root.find(j.ExportSpecifier).forEach(p => {
120
- const local = p.node.local ?? p.node.exported;
121
- if (local?.type === 'Identifier')
122
- reExported.add(local.name);
123
- });
112
+ const reExported = reExportedLocals(j, root);
124
113
  // ---- 1b. Resolve `const { Input, Field: F } = Form` destructuring -----
114
+ const destructurings = makeDestructuringPlan(ctx);
125
115
  root.find(j.VariableDeclarator).forEach(path => {
126
116
  const node = path.node;
127
117
  if (node.id?.type !== 'ObjectPattern' || node.init?.type !== 'Identifier')
128
118
  return;
129
119
  const base = node.init.name;
130
- const baseAlias = aliasAt(base, path);
131
- const imported = imports.get(base) ?? baseAlias?.join('.');
132
- if (!imported || imported === '*')
133
- return;
134
- if (!imports.has(base) && !baseAlias)
135
- return;
136
- const basePath = imports.has(base)
120
+ // By binding: a parameter named like the import is the caller's object.
121
+ const fromImport = imports.has(base) && resolvesToBinding(path, base, programScope);
122
+ const basePath = fromImport
137
123
  ? [imports.get(base)]
138
- : baseAlias;
124
+ : aliasAt(base, path);
125
+ if (!basePath || basePath[0] === '*')
126
+ return;
139
127
  let allResolved = true;
140
128
  for (const prop of node.id.properties) {
141
129
  if ((prop.type === 'ObjectProperty' || prop.type === 'Property') &&
@@ -165,23 +153,13 @@ export default function transform(fileInfo, api, options = {}) {
165
153
  allResolved = false;
166
154
  }
167
155
  }
168
- const exportsAnAlias = node.id.properties.some((prop) => (prop.type === 'ObjectProperty' || prop.type === 'Property') &&
169
- prop.value?.type === 'Identifier' &&
170
- reExported.has(prop.value.name));
171
- if (allResolved && !exportsAnAlias) {
172
- const declaration = path.parent;
173
- if (declaration?.node?.type === 'VariableDeclaration' &&
174
- declaration.node.declarations.length === 1) {
175
- declaration.prune();
176
- }
177
- else {
178
- path.prune();
179
- }
180
- ctx.dirty = true;
181
- }
182
- else {
183
- addTodo(ctx, path, 'imports', `could not resolve every name destructured from \`${base}\`; migrate the leftovers by hand`);
184
- }
156
+ const kept = allResolved
157
+ ? keptForExport(path, basePath, reExported, resolveMapping)
158
+ : `could not resolve every name destructured from \`${base}\`; migrate the leftovers by hand`;
159
+ if (kept)
160
+ destructurings.keep(path, basePath[0], kept);
161
+ else
162
+ destructurings.prune(path, basePath[0]);
185
163
  });
186
164
  /** Resolve a JSX name into a canonical RBC component path, or null. */
187
165
  function resolveJsxPath(name, at) {
@@ -204,6 +182,8 @@ export default function transform(fileInfo, api, options = {}) {
204
182
  return [imported, ...rest];
205
183
  }
206
184
  ctx.resolve = resolveJsxPath;
185
+ // 1b's decisions land here, before the bindings below are read.
186
+ destructurings.settle();
207
187
  // ---- 1c. Collect local bindings so new imports never collide -----------
208
188
  // A file may already bind names like `Field` or `Control` (components,
209
189
  // variables, function params); importing the bestax component under the
@@ -224,8 +204,12 @@ export default function transform(fileInfo, api, options = {}) {
224
204
  // `partial`, but `<Icon.Unknown>` retains it), and when the local name
225
205
  // differs from the imported one that retained binding can collide with a
226
206
  // bestax local for a completely different component. An unaliased import
227
- // is safe: its name already means the same component on both sides.
228
- if (!entry || entry.status === 'todo' || local !== imported) {
207
+ // is safe: its name already means the same component on both sides. A
208
+ // root a kept destructuring names (1b) is retained already.
209
+ if (!entry ||
210
+ entry.status === 'todo' ||
211
+ local !== imported ||
212
+ ctx.retained.has(imported)) {
229
213
  bound.add(local);
230
214
  }
231
215
  }
@@ -383,6 +367,8 @@ export default function transform(fileInfo, api, options = {}) {
383
367
  return;
384
368
  if (handledValueRefs.has(path.node))
385
369
  return;
370
+ if (destructurings.kept.has(path.node))
371
+ return;
386
372
  const name = path.node.name;
387
373
  // A name bound by `const { Field } = Form` lives in `aliases`, not
388
374
  // `imports`, and the destructuring pass has already deleted the
@@ -412,6 +398,10 @@ export default function transform(fileInfo, api, options = {}) {
412
398
  // runtime, so it is not a value use of the namespace at all.
413
399
  if (parentType === 'TSQualifiedName')
414
400
  return;
401
+ // A public name (`export { Card as Header }`) or a name in
402
+ // `export { Header } from './other'` binds nothing here.
403
+ if (namesNoLocal(path))
404
+ return;
415
405
  // A namespace binding in a real value position. `RBC.Box` is still a
416
406
  // mappable component reference, so fall through to the member-expression
417
407
  // branch below with an empty prefix (the namespace itself is not part of
@@ -432,15 +422,11 @@ export default function transform(fileInfo, api, options = {}) {
432
422
  // target keeps the public name (\`export { SubTitle as Subtitle }\`), a
433
423
  // dotted one cannot be re-exported under a member name and is flagged.
434
424
  if (parentType === 'ExportSpecifier') {
435
- if (parentNode.local !== path.node)
436
- return;
437
425
  const exportedName = nameOf(parentNode.exported ?? parentNode.local);
438
426
  const mapping = aliasPath ? resolveMapping(aliasPath) : MAPPING[imported];
439
- if (mapping &&
440
- mapping.status !== 'todo' &&
441
- mapping.target &&
442
- !mapping.target.includes('.')) {
443
- const local = ctx.reserve(mapping.target);
427
+ const flat = flatReExportTarget(mapping);
428
+ if (flat) {
429
+ const local = ctx.reserve(flat);
444
430
  // Replace the node: recast reprints a specifier whose identifiers were
445
431
  // swapped in place in its original shorthand form, dropping the `as`.
446
432
  path.parent.replace(j.exportSpecifier.from({
@@ -490,8 +476,10 @@ export default function transform(fileInfo, api, options = {}) {
490
476
  outer.node.property?.type === 'Identifier') {
491
477
  memberPath.push(nameOf(outer.node.property));
492
478
  const next = outer.parent;
479
+ // Not into `[…]`, which the rebuilt chain would drop.
493
480
  if (next?.node?.type === 'MemberExpression' &&
494
- next.node.object === outer.node) {
481
+ next.node.object === outer.node &&
482
+ !next.node.computed) {
495
483
  outer = next;
496
484
  }
497
485
  else {
@@ -515,7 +503,7 @@ export default function transform(fileInfo, api, options = {}) {
515
503
  for (const part of rest) {
516
504
  rebuilt = j.memberExpression(rebuilt, j.identifier(part));
517
505
  }
518
- outer.replace(rebuilt);
506
+ replaceChain(outer, rebuilt, handledValueRefs);
519
507
  ctx.dirty = true;
520
508
  return;
521
509
  }
@@ -531,7 +519,7 @@ export default function transform(fileInfo, api, options = {}) {
531
519
  for (const part of aliasRest) {
532
520
  rebuilt = j.memberExpression(rebuilt, j.identifier(part));
533
521
  }
534
- outer.replace(rebuilt);
522
+ replaceChain(outer, rebuilt, handledValueRefs);
535
523
  ctx.dirty = true;
536
524
  return;
537
525
  }
@@ -547,7 +535,7 @@ export default function transform(fileInfo, api, options = {}) {
547
535
  if (!memberMapping.target.includes('.')) {
548
536
  // Flat target (Icon.Text → IconText): swap the whole chain.
549
537
  const local = ctx.reserve(memberMapping.target);
550
- outer.replace(j.identifier(local));
538
+ replaceChain(outer, j.identifier(local), handledValueRefs);
551
539
  ctx.dirty = true;
552
540
  return;
553
541
  }
@@ -560,7 +548,7 @@ export default function transform(fileInfo, api, options = {}) {
560
548
  for (const part of targetRest) {
561
549
  rebuilt = j.memberExpression(rebuilt, j.identifier(part));
562
550
  }
563
- outer.replace(rebuilt);
551
+ replaceChain(outer, rebuilt, handledValueRefs);
564
552
  ctx.dirty = true;
565
553
  return;
566
554
  }
@@ -654,7 +642,6 @@ export default function transform(fileInfo, api, options = {}) {
654
642
  });
655
643
  // ---- 3. Rewrite imports -----------------------------------------------
656
644
  if (imports.size > 0) {
657
- const retainedNames = [...ctx.retained].sort((a, b) => a.localeCompare(b));
658
645
  const bestaxImport = buildBestaxImport(ctx, bestaxImportState);
659
646
  let inserted = false;
660
647
  // A retained RBC specifier must never collide with a bestax import local
@@ -681,11 +668,7 @@ export default function transform(fileInfo, api, options = {}) {
681
668
  }
682
669
  if (keepSpecifiers.length > 0) {
683
670
  node.specifiers = keepSpecifiers;
684
- node.comments = node.comments ?? [];
685
- const text = ` TODO(bestax-migrate): ${retainedNames.join(', ')} ${retainedNames.length === 1 ? 'has' : 'have'} no bestax-bulma equivalent yet — migrate and remove this import`;
686
- if (!node.comments.some((c) => c.value === text)) {
687
- node.comments.push(j.commentLine(text, true, false));
688
- }
671
+ noteRetainedImport(ctx, path, ctx.retained);
689
672
  }
690
673
  else {
691
674
  carryPrunedComments(node, path, bestaxImportState.existing?.node ?? bestaxImport);
package/dist/types.d.ts CHANGED
@@ -132,9 +132,10 @@ export interface DepsOptions {
132
132
  /** True when migrated sources still reference `bulma/…` specifiers. */
133
133
  bulmaReferenced?: boolean;
134
134
  /**
135
- * True when at least one migrated file still imports the SOURCE library —
136
- * the trimmed, TODO-annotated import the transform deliberately keeps for
137
- * components with no bestax equivalent. Removing the package from the
135
+ * True when a file under the run's paths still imports the SOURCE library:
136
+ * a trimmed, TODO-annotated import the transform kept, one it couldn't
137
+ * rewrite, or a file it couldn't parse or doesn't read (`.vue`, `.astro`).
138
+ * Removing the package from the
138
139
  * manifest while those remain leaves them unresolvable after the install
139
140
  * step the report tells the user to run.
140
141
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sEAAsE;IACtE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,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,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;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;IAC/C,uEAAuE;IACvE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC3D;;;OAGG;IACH,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,2DAA2D;IAC3D,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,CAAC;IACtE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bestax-migrate",
3
- "version": "2.40.1",
3
+ "version": "2.41.1",
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,26 +34,26 @@
34
34
  "url": "https://github.com/allxsmith/bestax/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@babel/parser": "^7.29.13",
37
+ "@babel/parser": "^7.29.15",
38
38
  "chalk": "^6.0.1",
39
39
  "commander": "^15.1.0",
40
40
  "jscodeshift": "^17.3.0",
41
41
  "parse5": "^8.1.1",
42
42
  "property-information": "^7.2.0",
43
- "@allxsmith/bestax-bulma": "^5.81.0"
43
+ "@allxsmith/bestax-bulma": "^5.81.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/jscodeshift": "^17.3.0",
47
47
  "@types/node": "^26.6.6",
48
48
  "@types/react": "^19.3.0",
49
49
  "@types/react-dom": "^19.3.0",
50
- "@vitest/coverage-istanbul": "^5.1.0",
50
+ "@vitest/coverage-istanbul": "^5.1.1",
51
51
  "classnames": "^2.5.1",
52
52
  "clsx": "^2.1.1",
53
53
  "react": "^19.3.1",
54
54
  "react-dom": "^19.3.1",
55
55
  "typescript": "^6.0.3",
56
- "vitest": "^5.1.0"
56
+ "vitest": "^5.1.1"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
@@ -76,5 +76,5 @@
76
76
  "clean": "rimraf dist",
77
77
  "release": "npx semantic-release"
78
78
  },
79
- "readme": "# bestax-migrate\n\n[![npm version](https://img.shields.io/npm/v/bestax-migrate.svg)](https://www.npmjs.com/package/bestax-migrate)\n[![npm downloads](https://img.shields.io/npm/dm/bestax-migrate.svg)](https://www.npmjs.com/package/bestax-migrate)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Socket Badge](https://badge.socket.dev/npm/package/bestax-migrate/latest)](https://socket.dev/npm/package/bestax-migrate/overview)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/allxsmith/bestax/badge)](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/14361/badge)](https://www.bestpractices.dev/projects/14361)\n[![npm provenance](https://img.shields.io/badge/npm-provenance-3fb950.svg)](https://www.npmjs.com/package/bestax-migrate#provenance)\n[![Security policy](https://img.shields.io/badge/security-policy-blue.svg)](https://github.com/allxsmith/bestax/blob/main/SECURITY.md)\n\nCodemods that migrate existing React apps to [`@allxsmith/bestax-bulma`](https://www.npmjs.com/package/@allxsmith/bestax-bulma) — the actively maintained React component library for **Bulma v1**.\n\nCurrently supported sources:\n\n| Source | Status |\n| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |\n| [`react-bulma-components`](https://github.com/couds/react-bulma-components) (v4) | ✅ All 32 components mapped (a few patterns are flagged as TODOs) |\n| [`rbx`](https://github.com/dfee/rbx) (v2) | ✅ Full export surface mapped (a few patterns are flagged as TODOs) |\n| [`bloomer`](https://github.com/AlgusDark/bloomer) (0.6) | ✅ All 108 exports mapped (Font Awesome 4 icons and Bulma 0.4's `Nav` are flagged) |\n| `bulma-classes`: Bulma's classes on plain JSX, no library | ✅ Converts an element only when bestax renders the same markup; the rest is flagged |\n| `bulma-classes` on HTML: static pages and templates styled with Bulma | ✅ Writes a React component beside each page; its head and scripts are flagged |\n\nPass the source as the first argument: `bestax-migrate <source> <paths…>`.\n\n## Requirements\n\n**Node.js 22 or newer.** Node 18 and 20 are both past end-of-life. On an older runtime the CLI\nexits immediately with an explicit upgrade message.\n\nThis applies only to the Node version the codemod itself runs on. It places no requirement on\nthe app being migrated — the source is read as text and is never executed.\n\n## Usage\n\n```bash\n# Preview what would change (no writes)\npnpm dlx bestax-migrate react-bulma-components src/ --dry\n# …or, for an rbx or bloomer app\npnpm dlx bestax-migrate rbx src/ --dry\npnpm dlx bestax-migrate bloomer src/ --dry\n# …or, for an app that writes Bulma's classes on plain JSX\npnpm dlx bestax-migrate bulma-classes src/ --dry\n# …or, for static HTML pages styled with Bulma: name a page, or walk a folder with -e html\n# (-e html,htm takes .htm pages too)\npnpm dlx bestax-migrate bulma-classes src/pages/login/index.html --dry\npnpm dlx bestax-migrate bulma-classes -e html src/pages/ --dry\n\n# Apply the migration\npnpm dlx bestax-migrate react-bulma-components src/\n```\n\nnpm and yarn work too: `npx bestax-migrate …` / `yarn dlx bestax-migrate …`.\n\nThe codemod uses [jscodeshift](https://github.com/facebook/jscodeshift) to:\n\n- rewrite the source library's imports to `@allxsmith/bestax-bulma` (including destructuring and namespace imports)\n- rename components and compound sub-components (`Form.Textarea` → `TextArea`, `Card.Footer.Item` → `Card.FooterItem`, `Hero.Footer` → `Hero.Foot`, …) — and, for bloomer, its flat names onto bestax's compounds (`CardHeaderTitle` → `Card.Header.Title`)\n- convert props (`renderAs` → `as`, `loading` → `isLoading`, numeric spacing/text sizes → string unions, `textAlign=\"center\"` → `textAlign=\"centered\"`, …)\n- flatten responsive breakpoint objects (`mobile={{ size: 4 }}` → `sizeMobile={4}`) and bloomer's `isDisplay`/`isHidden` strings, arrays and objects (`isHidden=\"touch\"` → `visibilityTouch=\"hidden\"`)\n- for `bulma-classes`, turn raw Bulma markup into components and props (`<a className=\"button is-primary\">` → `<Button as=\"a\" color=\"primary\">`, `<p className=\"has-text-centered mt-4\">` → `<Paragraph textAlign=\"centered\" mt=\"4\">`), converting an element only when bestax renders exactly the same markup\n- for `bulma-classes` on an HTML page, write a React module beside it (`index.html` → `index.tsx`, or `.jsx` when the package isn't TypeScript) whose default export is the page's body as a component (`LoginPage`), converted as the same markup written as JSX would be. The page is never changed and an existing module is never overwritten; the head, the `<html>` and `<body>` attributes, the stylesheets and scripts it loads, and inline handlers are left as `html-*` TODOs, except that under `--css bestax` or `--css bulma` the module imports the stylesheet in place of the page's Bulma `<link>`\n- restructure patterns bestax models differently (`Table.Container`, Navbar dropdowns, `Form.Help`, icon-font children → `<Icon name=…>`)\n- migrate stylesheets: CSS imports converge on `@allxsmith/bestax-bulma/bestax.css`, and SCSS files move from Bulma 0.9's `@import` + `$var !default` overrides to `@use 'bulma/sass' with (…)` plus `@use '@allxsmith/bestax-bulma/scss/extras'`\n- update `package.json`: remove the source library, add `@allxsmith/bestax-bulma`, raise a declared pre-1.0 `bulma` to `^1` (adding it only when your sources import `bulma/…` directly — otherwise it arrives transitively), and swap the dead `node-sass` for dart `sass` (no install is ever run). Migrating **rbx** is what frees an app from Bulma 0.7.5: rbx pinned it as a _direct_ dependency, so the app could not choose its own Bulma version at all. The four Bulma extensions rbx also pulled in (`bulma-badge`, `bulma-divider`, `bulma-pageloader`, `bulma-tooltip`) are **reported rather than removed** — bestax replaces all four, but a manifest entry is a deliberate declaration and your own Sass may import them. A **bloomer** app declared its own Bulma 0.6, which is what gets bumped. For **bulma-classes** there is no library to remove, and by default (`--css keep`) the app's Bulma version, Sass and stylesheet imports all stay: its own Bulma already styles every class a converted element renders. `--css bestax` or `--css bulma` moves it to Bulma v1 like the other sources\n\nAnything without a safe automatic conversion is left in place with a `// TODO(bestax-migrate): …` comment, and the run ends with a report of every TODO by file and line. TODOs are expected output, not errors — resolve them with the migration guide ([react-bulma-components](https://bestax.io/docs/guides/getting-started/migration/react-bulma-components), [rbx](https://bestax.io/docs/guides/getting-started/migration/rbx), [bloomer](https://bestax.io/docs/guides/getting-started/migration/bloomer), [Bulma classes](https://bestax.io/docs/guides/getting-started/migration/bulma-classes)), or let the [`bestax-migrate` Agent Skill](https://bestax.io/docs/skills/intro) walk them for you:\n\n```bash\nnpx skills add https://github.com/allxsmith/bestax --skill bestax-migrate\n```\n\n### Through the Codemod Registry\n\nbestax-migrate is also in the [Codemod Registry](https://app.codemod.com/registry) as `bestax-migrate`, for teams that run their migrations through Codemod. That package runs this CLI from npm at a pinned release, which can trail the newest one:\n\n```bash\n# Preview (no writes)\nnpx codemod bestax-migrate --workflow preview --param source=react-bulma-components\n# Apply\nnpx codemod bestax-migrate --param source=react-bulma-components\n```\n\nRun it from your app root. `--param paths=\"src lib\"` (default `src`) and `--param options=\"--css keep\"` pass through to the CLI. Codemod's own `--dry-run` skips the shell step this package runs, so use the `preview` workflow for a dry run.\n\n## Options\n\n| Flag | Description |\n| -------------------- | ---------------------------------------------------------------------------------------------- |\n| `--dry`, `-d` | Report what would change without writing files |\n| `--print`, `-p` | Print transformed sources to stdout, still writing them unless `--dry` is set |\n| `--extensions`, `-e` | File extensions to include in a folder (default `js,jsx,ts,tsx,scss,sass`; `html` for pages) |\n| `--css <mode>` | Stylesheet target: `bestax`, `bulma`, or `keep` (default `bestax`; `keep` for `bulma-classes`) |\n| `--no-deps` | Skip updating package.json dependencies |\n\n## Exit codes\n\n| Code | Meaning |\n| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `0` | The run finished. TODOs are expected output and leave it at 0 |\n| `1` | A file could not be parsed or transformed. It is marked `✖`, listed in the report and left as it was, and every other file is still migrated. Fix it and run the codemod on it again. A run like that sends no telemetry |\n| `1` | The command was refused before the run: an unknown source, flag or `--css` mode, a path that isn't there, an HTML page for a source that reads none, or Node older than 22 |\n| `130` | Ctrl-C at the telemetry question, which comes after the run |\n\n`--help` lists them too. With `--dry`, a file that fails to parse still makes the exit code 1, so a preview in CI catches it. A file the run can't read at all stops it there instead, with Node's error and exit code 1, before `package.json` is updated.\n\n## After the codemod\n\n1. Run your package manager's install (the codemod rewrote `package.json` but never installs)\n2. Search for `TODO(bestax-migrate)` and resolve each comment\n3. Typecheck/build and review the rendered app\n\nFull walkthrough: [react-bulma-components migration guide](https://bestax.io/docs/guides/getting-started/migration/react-bulma-components) · [rbx migration guide](https://bestax.io/docs/guides/getting-started/migration/rbx) · [bloomer migration guide](https://bestax.io/docs/guides/getting-started/migration/bloomer) · [Bulma classes migration guide](https://bestax.io/docs/guides/getting-started/migration/bulma-classes).\n\n## Hardened by default\n\nA codemod rewrites your source in place, so how it is built and published matters:\n\n- **Signed provenance** — every release carries a sigstore attestation linking the tarball to the exact commit and CI run that built it. Check the **Provenance** section on the [npm page](https://www.npmjs.com/package/bestax-migrate#provenance), or run `npm audit signatures`.\n- **npm OIDC trusted publishing** — short-lived, per-run credentials; no long-lived `NPM_TOKEN` exists to be stolen. Release commits and tags are GPG-signed.\n- **Socket.dev scans every PR** for malware, install scripts, obfuscated code, and privilege escalation before it can reach `main`.\n- **The libraries this tool migrates away from are never installed here** — source fixtures are read as text only, so no unmaintained third-party package enters the dependency tree.\n- **Dependencies are a deliberate act** — install scripts are blocked unless individually allow-listed, freshly published versions are refused for 3 days, and CI installs only what the reviewed lockfile resolves.\n- **Every GitHub Action is pinned to a full commit SHA**, and CodeQL, Dependency Review, and Dependabot run continuously alongside a high-severity `pnpm audit` gate.\n- **Layered AI review before merge** — [CodeRabbit](https://coderabbit.ai) plus an independent adversarial Claude review (a different model from the one writing AI-authored changes), on top of required green CI, an approving review, and a human merge.\n\nFull detail: [`SECURITY.md`](https://github.com/allxsmith/bestax/blob/main/SECURITY.md) · [Security guide](https://bestax.io/docs/guides/security)\n\n## Telemetry\n\n`bestax-migrate` can send one **anonymous** usage event after a successful\nrun — only if you opt in when asked (once, on an interactive terminal). The\nevent is just the run's shape — source library, CSS mode, the dry/deps flags, a\ncapped changed-file count, and per-rule TODO counts — plus the CLI version,\nNode major version, and OS platform name. Never file paths, file contents,\ncode, names, IPs, or machine IDs, and no identifier exists that could link two\nevents together. Opt out any time with `--no-telemetry`,\n`BESTAX_TELEMETRY=0`, or `DO_NOT_TRACK=1`.\n\nFull disclosure of every field and control: [Telemetry guide](https://bestax.io/docs/guides/telemetry)\n\n## License\n\nSource code licensed MIT\n"
79
+ "readme": "# bestax-migrate\n\n[![npm version](https://img.shields.io/npm/v/bestax-migrate.svg)](https://www.npmjs.com/package/bestax-migrate)\n[![npm downloads](https://img.shields.io/npm/dm/bestax-migrate.svg)](https://www.npmjs.com/package/bestax-migrate)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Socket Badge](https://badge.socket.dev/npm/package/bestax-migrate/latest)](https://socket.dev/npm/package/bestax-migrate/overview)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/allxsmith/bestax/badge)](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/14361/badge)](https://www.bestpractices.dev/projects/14361)\n[![npm provenance](https://img.shields.io/badge/npm-provenance-3fb950.svg)](https://www.npmjs.com/package/bestax-migrate#provenance)\n[![Security policy](https://img.shields.io/badge/security-policy-blue.svg)](https://github.com/allxsmith/bestax/blob/main/SECURITY.md)\n\nCodemods that migrate existing React apps to [`@allxsmith/bestax-bulma`](https://www.npmjs.com/package/@allxsmith/bestax-bulma) — the actively maintained React component library for **Bulma v1**.\n\nCurrently supported sources:\n\n| Source | Status |\n| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |\n| [`react-bulma-components`](https://github.com/couds/react-bulma-components) (v4) | ✅ All 32 components mapped (a few patterns are flagged as TODOs) |\n| [`rbx`](https://github.com/dfee/rbx) (v2) | ✅ Full export surface mapped (a few patterns are flagged as TODOs) |\n| [`bloomer`](https://github.com/AlgusDark/bloomer) (0.6) | ✅ All 108 exports mapped (Font Awesome 4 icons and Bulma 0.4's `Nav` are flagged) |\n| `bulma-classes`: Bulma's classes on plain JSX, no library | ✅ Converts an element only when bestax renders the same markup; the rest is flagged |\n| `bulma-classes` on HTML: static pages and templates styled with Bulma | ✅ Writes a React component beside each page; its head and scripts are flagged |\n\nPass the source as the first argument: `bestax-migrate <source> <paths…>`.\n\n## Requirements\n\n**Node.js 22 or newer.** Node 18 and 20 are both past end-of-life. On an older runtime the CLI\nexits immediately with an explicit upgrade message.\n\nThis applies only to the Node version the codemod itself runs on. It places no requirement on\nthe app being migrated — the source is read as text and is never executed.\n\n## Usage\n\n```bash\n# Preview what would change (no writes)\npnpm dlx bestax-migrate react-bulma-components src/ --dry\n# …or, for an rbx or bloomer app\npnpm dlx bestax-migrate rbx src/ --dry\npnpm dlx bestax-migrate bloomer src/ --dry\n# …or, for an app that writes Bulma's classes on plain JSX\npnpm dlx bestax-migrate bulma-classes src/ --dry\n# …or, for static HTML pages styled with Bulma: name a page, or walk a folder with -e html\n# (-e html,htm takes .htm pages too)\npnpm dlx bestax-migrate bulma-classes src/pages/login/index.html --dry\npnpm dlx bestax-migrate bulma-classes -e html src/pages/ --dry\n\n# Apply the migration\npnpm dlx bestax-migrate react-bulma-components src/\n```\n\nnpm and yarn work too: `npx bestax-migrate …` / `yarn dlx bestax-migrate …`.\n\nThe codemod uses [jscodeshift](https://github.com/facebook/jscodeshift) to:\n\n- rewrite the source library's imports to `@allxsmith/bestax-bulma` (including destructuring and namespace imports)\n- rename components and compound sub-components (`Form.Textarea` → `TextArea`, `Card.Footer.Item` → `Card.FooterItem`, `Hero.Footer` → `Hero.Foot`, …) — and, for bloomer, its flat names onto bestax's compounds (`CardHeaderTitle` → `Card.Header.Title`)\n- convert props (`renderAs` → `as`, `loading` → `isLoading`, numeric spacing/text sizes → string unions, `textAlign=\"center\"` → `textAlign=\"centered\"`, …)\n- flatten responsive breakpoint objects (`mobile={{ size: 4 }}` → `sizeMobile={4}`) and bloomer's `isDisplay`/`isHidden` strings, arrays and objects (`isHidden=\"touch\"` → `visibilityTouch=\"hidden\"`)\n- for `bulma-classes`, turn raw Bulma markup into components and props (`<a className=\"button is-primary\">` → `<Button as=\"a\" color=\"primary\">`, `<p className=\"has-text-centered mt-4\">` → `<Paragraph textAlign=\"centered\" mt=\"4\">`), converting an element only when bestax renders exactly the same markup\n- for `bulma-classes` on an HTML page, write a React module beside it (`index.html` → `index.tsx`, or `.jsx` when the package isn't TypeScript) whose default export is the page's body as a component (`LoginPage`), converted as the same markup written as JSX would be. The page is never changed and an existing module is never overwritten; the head, the `<html>` and `<body>` attributes, the stylesheets and scripts it loads, and inline handlers are left as `html-*` TODOs, except that under `--css bestax` or `--css bulma` the module imports the stylesheet in place of the page's Bulma `<link>`\n- restructure patterns bestax models differently (`Table.Container`, Navbar dropdowns, `Form.Help`, icon-font children → `<Icon name=…>`)\n- migrate stylesheets: CSS imports converge on `@allxsmith/bestax-bulma/bestax.css`, and SCSS files move from Bulma 0.9's `@import` + `$var !default` overrides to `@use 'bulma/sass' with (…)` plus `@use '@allxsmith/bestax-bulma/scss/extras'`\n- update `package.json`: remove the source library, add `@allxsmith/bestax-bulma` (or report the one you already declare or have installed when it is older than the release the migrated code is written for), raise a declared pre-1.0 `bulma` to `^1` (adding it only when your sources import `bulma/…` directly — otherwise it arrives transitively), and swap the dead `node-sass` for dart `sass` (no install is ever run). Migrating **rbx** is what frees an app from Bulma 0.7.5: rbx pinned it as a _direct_ dependency, so the app could not choose its own Bulma version at all. The four Bulma extensions rbx also pulled in (`bulma-badge`, `bulma-divider`, `bulma-pageloader`, `bulma-tooltip`) are **reported rather than removed** — bestax replaces all four, but a manifest entry is a deliberate declaration and your own Sass may import them. A **bloomer** app declared its own Bulma 0.6, which is what gets bumped. For **bulma-classes** there is no library to remove, and by default (`--css keep`) the app's Bulma version, Sass and stylesheet imports all stay: its own Bulma already styles every class a converted element renders. `--css bestax` or `--css bulma` moves it to Bulma v1 like the other sources\n\nAnything without a safe automatic conversion is left in place with a `// TODO(bestax-migrate): …` comment, and the run ends with a report of every TODO by file and line. TODOs are expected output, not errors — resolve them with the migration guide ([react-bulma-components](https://bestax.io/docs/guides/getting-started/migration/react-bulma-components), [rbx](https://bestax.io/docs/guides/getting-started/migration/rbx), [bloomer](https://bestax.io/docs/guides/getting-started/migration/bloomer), [Bulma classes](https://bestax.io/docs/guides/getting-started/migration/bulma-classes)), or let the [`bestax-migrate` Agent Skill](https://bestax.io/docs/skills/intro) walk them for you:\n\n```bash\nnpx skills add https://github.com/allxsmith/bestax --skill bestax-migrate\n```\n\n### Through the Codemod Registry\n\nbestax-migrate is also in the [Codemod Registry](https://app.codemod.com/registry) as `bestax-migrate`, for teams that run their migrations through Codemod. That package runs this CLI from npm at a pinned release, which can trail the newest one:\n\n```bash\n# Preview (no writes)\nnpx codemod bestax-migrate --workflow preview --param source=react-bulma-components\n# Apply\nnpx codemod bestax-migrate --param source=react-bulma-components\n```\n\nRun it from your app root. `--param paths=\"src lib\"` (default `src`) and `--param options=\"--css keep\"` pass through to the CLI. Codemod's own `--dry-run` skips the shell step this package runs, so use the `preview` workflow for a dry run.\n\n## Options\n\n| Flag | Description |\n| -------------------- | ---------------------------------------------------------------------------------------------- |\n| `--dry`, `-d` | Report what would change without writing files |\n| `--print`, `-p` | Print transformed sources to stdout, still writing them unless `--dry` is set |\n| `--extensions`, `-e` | File extensions to include in a folder (default `js,jsx,ts,tsx,scss,sass`; `html` for pages) |\n| `--css <mode>` | Stylesheet target: `bestax`, `bulma`, or `keep` (default `bestax`; `keep` for `bulma-classes`) |\n| `--no-deps` | Skip updating package.json dependencies |\n\n## Exit codes\n\n| Code | Meaning |\n| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `0` | The run finished. TODOs are expected output and leave it at 0 |\n| `1` | A file could not be parsed or transformed. It is marked `✖`, listed in the report and left as it was, and every other file is still migrated. Fix it and run the codemod on it again. A run like that sends no telemetry |\n| `1` | The command was refused before the run: an unknown source, flag or `--css` mode, a path that isn't there, an HTML page for a source that reads none, or Node older than 22 |\n| `130` | Ctrl-C at the telemetry question, which comes after the run |\n\n`--help` lists them too. With `--dry`, a file that fails to parse still makes the exit code 1, so a preview in CI catches it. A file the run can't read at all stops it there instead, with Node's error and exit code 1, before `package.json` is updated.\n\n## After the codemod\n\n1. Run your package manager's install (the codemod rewrote `package.json` but never installs)\n2. Search for `TODO(bestax-migrate)` and resolve each comment\n3. Typecheck/build and review the rendered app\n\nFull walkthrough: [react-bulma-components migration guide](https://bestax.io/docs/guides/getting-started/migration/react-bulma-components) · [rbx migration guide](https://bestax.io/docs/guides/getting-started/migration/rbx) · [bloomer migration guide](https://bestax.io/docs/guides/getting-started/migration/bloomer) · [Bulma classes migration guide](https://bestax.io/docs/guides/getting-started/migration/bulma-classes).\n\n## Hardened by default\n\nA codemod rewrites your source in place, so how it is built and published matters:\n\n- **Signed provenance** — every release carries a sigstore attestation linking the tarball to the exact commit and CI run that built it. Check the **Provenance** section on the [npm page](https://www.npmjs.com/package/bestax-migrate#provenance), or run `npm audit signatures`.\n- **npm OIDC trusted publishing** — short-lived, per-run credentials; no long-lived `NPM_TOKEN` exists to be stolen. Release commits and tags are GPG-signed.\n- **Socket.dev scans every PR** for malware, install scripts, obfuscated code, and privilege escalation before it can reach `main`.\n- **The libraries this tool migrates away from are never installed here** — source fixtures are read as text only, so no unmaintained third-party package enters the dependency tree.\n- **Dependencies are a deliberate act** — install scripts are blocked unless individually allow-listed, freshly published versions are refused for 3 days, and CI installs only what the reviewed lockfile resolves.\n- **Every GitHub Action is pinned to a full commit SHA**, and CodeQL, Dependency Review, and Dependabot run continuously alongside a high-severity `pnpm audit` gate.\n- **Layered AI review before merge** — [CodeRabbit](https://coderabbit.ai) plus an independent adversarial Claude review (a different model from the one writing AI-authored changes), on top of required green CI, an approving review, and a human merge.\n\nFull detail: [`SECURITY.md`](https://github.com/allxsmith/bestax/blob/main/SECURITY.md) · [Security guide](https://bestax.io/docs/guides/security)\n\n## Telemetry\n\n`bestax-migrate` can send one **anonymous** usage event after a successful\nrun — only if you opt in when asked (once, on an interactive terminal). The\nevent is just the run's shape — source library, CSS mode, the dry/deps flags, a\ncapped changed-file count, and per-rule TODO counts — plus the CLI version,\nNode major version, and OS platform name. Never file paths, file contents,\ncode, names, IPs, or machine IDs, and no identifier exists that could link two\nevents together. Opt out any time with `--no-telemetry`,\n`BESTAX_TELEMETRY=0`, or `DO_NOT_TRACK=1`.\n\nFull disclosure of every field and control: [Telemetry guide](https://bestax.io/docs/guides/telemetry)\n\n## License\n\nSource code licensed MIT\n"
80
80
  }