bestax-migrate 2.40.0 → 2.41.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/README.md +1 -1
- package/dist/sources/_shared/bestax-floor.d.ts +49 -0
- package/dist/sources/_shared/bestax-floor.d.ts.map +1 -1
- package/dist/sources/_shared/bestax-floor.js +84 -0
- package/dist/sources/_shared/bestax-import.d.ts +16 -1
- package/dist/sources/_shared/bestax-import.d.ts.map +1 -1
- package/dist/sources/_shared/bestax-import.js +67 -2
- package/dist/sources/_shared/bestax-release.d.ts +27 -0
- package/dist/sources/_shared/bestax-release.d.ts.map +1 -0
- package/dist/sources/_shared/bestax-release.js +79 -0
- package/dist/sources/_shared/deps-common.d.ts +11 -9
- package/dist/sources/_shared/deps-common.d.ts.map +1 -1
- package/dist/sources/_shared/deps-common.js +25 -11
- package/dist/sources/_shared/imports.d.ts +30 -1
- package/dist/sources/_shared/imports.d.ts.map +1 -1
- package/dist/sources/_shared/imports.js +67 -0
- package/dist/sources/_shared/jsx-utils.d.ts +8 -0
- package/dist/sources/_shared/jsx-utils.d.ts.map +1 -1
- package/dist/sources/_shared/jsx-utils.js +13 -0
- package/dist/sources/bloomer/deps.d.ts +2 -3
- package/dist/sources/bloomer/deps.d.ts.map +1 -1
- package/dist/sources/bloomer/deps.js +9 -9
- package/dist/sources/bloomer/mapping.d.ts +0 -10
- package/dist/sources/bloomer/mapping.d.ts.map +1 -1
- package/dist/sources/bloomer/mapping.js +2 -13
- package/dist/sources/bloomer/transform.d.ts +3 -2
- package/dist/sources/bloomer/transform.d.ts.map +1 -1
- package/dist/sources/bloomer/transform.js +44 -35
- package/dist/sources/bulma-classes/deps.d.ts +2 -2
- package/dist/sources/bulma-classes/deps.js +2 -2
- package/dist/sources/bulma-classes/html.js +1 -1
- package/dist/sources/rbx/deps.d.ts +2 -3
- package/dist/sources/rbx/deps.d.ts.map +1 -1
- package/dist/sources/rbx/deps.js +9 -9
- package/dist/sources/rbx/index.d.ts.map +1 -1
- package/dist/sources/rbx/index.js +6 -0
- package/dist/sources/rbx/transform.d.ts +3 -2
- package/dist/sources/rbx/transform.d.ts.map +1 -1
- package/dist/sources/rbx/transform.js +100 -54
- package/dist/sources/react-bulma-components/deps.d.ts +2 -2
- package/dist/sources/react-bulma-components/deps.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/deps.js +10 -9
- package/dist/sources/react-bulma-components/transform.d.ts +3 -2
- package/dist/sources/react-bulma-components/transform.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/transform.js +47 -47
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Source-agnostic: nothing here knows which library is being migrated.
|
|
7
7
|
*/
|
|
8
|
+
import { addTodo } from './jsx-utils.js';
|
|
8
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
10
|
export const nameOf = (node) => typeof node === 'string' ? node : String(node?.name ?? '');
|
|
10
11
|
/**
|
|
@@ -212,3 +213,69 @@ export function makeAliasRegistry() {
|
|
|
212
213
|
const anyAlias = (name) => ownersFor(name).length > 0;
|
|
213
214
|
return { register, aliasAt, anyAlias };
|
|
214
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* The flat bestax name a re-export of `mapping`'s component is written as
|
|
218
|
+
* (`export { Columns as Group }`), or undefined when it has none to write.
|
|
219
|
+
*/
|
|
220
|
+
export function flatReExportTarget(mapping) {
|
|
221
|
+
return mapping &&
|
|
222
|
+
mapping.status !== 'todo' &&
|
|
223
|
+
mapping.target &&
|
|
224
|
+
!mapping.target.includes('.')
|
|
225
|
+
? mapping.target
|
|
226
|
+
: undefined;
|
|
227
|
+
}
|
|
228
|
+
/** A `DestructuringPlan` for the transform whose context is `ctx`. */
|
|
229
|
+
export function makeDestructuringPlan(ctx) {
|
|
230
|
+
const kept = new WeakSet();
|
|
231
|
+
const keptPaths = [];
|
|
232
|
+
const prunable = [];
|
|
233
|
+
const keep = (path, root, message) => {
|
|
234
|
+
const declarator = path.node;
|
|
235
|
+
for (const prop of declarator.id.properties) {
|
|
236
|
+
if (prop.value?.type !== 'Identifier')
|
|
237
|
+
continue;
|
|
238
|
+
kept.add(prop.value);
|
|
239
|
+
if (prop.shorthand)
|
|
240
|
+
kept.add(prop.key);
|
|
241
|
+
}
|
|
242
|
+
kept.add(declarator.init);
|
|
243
|
+
ctx.retained.add(root);
|
|
244
|
+
keptPaths.push(path);
|
|
245
|
+
addTodo(ctx, path, 'imports', message);
|
|
246
|
+
};
|
|
247
|
+
const settle = () => {
|
|
248
|
+
for (let i = 0; i < keptPaths.length; i++) {
|
|
249
|
+
const base = keptPaths[i].node.init.name;
|
|
250
|
+
// Every binding of the name in that scope, since its table has no
|
|
251
|
+
// blocks. One kept too many costs a TODO; pruning the one it reads
|
|
252
|
+
// would leave it reading nothing.
|
|
253
|
+
const bindings = new Set((keptPaths[i].scope?.lookup(base)?.getBindings()[base] ?? []).map((binding) => binding.node));
|
|
254
|
+
for (let k = prunable.length - 1; k >= 0; k--) {
|
|
255
|
+
const { path, root } = prunable[k];
|
|
256
|
+
if (!path.node.id.properties.some((p) => bindings.has(p.value))) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
prunable.splice(k, 1);
|
|
260
|
+
keep(path, root, `kept for a destructuring of \`${base}\` that stays; migrate that one first`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
for (const { path } of prunable) {
|
|
264
|
+
const declaration = path.parent;
|
|
265
|
+
if (declaration?.node?.type === 'VariableDeclaration' &&
|
|
266
|
+
declaration.node.declarations.length === 1) {
|
|
267
|
+
declaration.prune();
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
path.prune();
|
|
271
|
+
}
|
|
272
|
+
ctx.dirty = true;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
return {
|
|
276
|
+
kept,
|
|
277
|
+
keep,
|
|
278
|
+
prune: (path, root) => prunable.push({ path, root }),
|
|
279
|
+
settle,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
@@ -55,6 +55,14 @@ export interface ResolvedElement {
|
|
|
55
55
|
export declare function jsxNameParts(name: any): string[] | null;
|
|
56
56
|
/** Build a JSXIdentifier / JSXMemberExpression chain from a dotted name. */
|
|
57
57
|
export declare function buildJsxName(j: JSCodeshift, dotted: string): any;
|
|
58
|
+
/**
|
|
59
|
+
* Replace the member chain at `chain` with `replacement`, putting the old
|
|
60
|
+
* chain's names in `handled`. A walk over the file's identifiers still
|
|
61
|
+
* reaches them, and the last one then reads as a child of `replacement`:
|
|
62
|
+
* `B.PageEllipsis` beside a named `PageEllipsis` import became
|
|
63
|
+
* `Pagination.Pagination.Ellipsis`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function replaceChain(chain: ASTPath<any>, replacement: any, handled: WeakSet<object>): void;
|
|
58
66
|
/** Rename both the opening and (when present) closing element. */
|
|
59
67
|
export declare function renameElement(j: JSCodeshift, element: any, dotted: string): void;
|
|
60
68
|
/** Non-spread attributes of an element. */
|
|
@@ -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,E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AAiB,CAAC,IAAI,EAAE,GAAG,GAAG,UAAU,CAIvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAGjE;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAG1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAW/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAajE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,IAAI,CAgDN;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAC1B,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,GAAG,EAAE,EACZ,QAAQ,EAAE,GAAG,EAAE,EACf,WAAW,UAAQ,GAClB,GAAG,CAsBL"}
|
|
@@ -30,6 +30,19 @@ export function buildJsxName(j, dotted) {
|
|
|
30
30
|
}
|
|
31
31
|
return node;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Replace the member chain at `chain` with `replacement`, putting the old
|
|
35
|
+
* chain's names in `handled`. A walk over the file's identifiers still
|
|
36
|
+
* reaches them, and the last one then reads as a child of `replacement`:
|
|
37
|
+
* `B.PageEllipsis` beside a named `PageEllipsis` import became
|
|
38
|
+
* `Pagination.Pagination.Ellipsis`.
|
|
39
|
+
*/
|
|
40
|
+
export function replaceChain(chain, replacement, handled) {
|
|
41
|
+
for (let node = chain.node; node?.type === 'MemberExpression' && !node.computed; node = node.object) {
|
|
42
|
+
handled.add(node.property);
|
|
43
|
+
}
|
|
44
|
+
chain.replace(replacement);
|
|
45
|
+
}
|
|
33
46
|
/** Rename both the opening and (when present) closing element. */
|
|
34
47
|
export function renameElement(j, element, dotted) {
|
|
35
48
|
element.openingElement.name = buildJsxName(j, dotted);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration: swap bloomer for @allxsmith/bestax-bulma, move the
|
|
3
|
-
* app's own Bulma to v1, and replace the dead node-sass with dart-sass.
|
|
4
|
-
*
|
|
5
|
-
* invoked (the report tells the user to install).
|
|
3
|
+
* app's own Bulma to v1, and replace the dead node-sass with dart-sass. No
|
|
4
|
+
* package manager is ever invoked (the report tells the user to install).
|
|
6
5
|
*
|
|
7
6
|
* bloomer is the react-bulma-components case, not the rbx one: it never
|
|
8
7
|
* depended on Bulma itself (its README says "npm install bulma"), so there is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/deps.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,eAAO,MAAM,kBAAkB,EAAE,kBAyChC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration: swap bloomer for @allxsmith/bestax-bulma, move the
|
|
3
|
-
* app's own Bulma to v1, and replace the dead node-sass with dart-sass.
|
|
4
|
-
*
|
|
5
|
-
* invoked (the report tells the user to install).
|
|
3
|
+
* app's own Bulma to v1, and replace the dead node-sass with dart-sass. No
|
|
4
|
+
* package manager is ever invoked (the report tells the user to install).
|
|
6
5
|
*
|
|
7
6
|
* bloomer is the react-bulma-components case, not the rbx one: it never
|
|
8
7
|
* depended on Bulma itself (its README says "npm install bulma"), so there is
|
|
@@ -25,13 +24,14 @@ export const updateDependencies = (filePath, pkg, collector, options) => {
|
|
|
25
24
|
manifest.note(`removed bloomer from ${name}`);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
27
|
+
// Files can still import the library after the run: a trimmed import the
|
|
28
|
+
// transform kept, so a partially migrated app still runs, one it couldn't
|
|
29
|
+
// rewrite, a file it couldn't parse or doesn't read (`.vue`, `.astro`).
|
|
30
|
+
// Removing the package from the manifest strands those imports once the
|
|
31
|
+
// user runs the install the report asks for, so say so rather than letting
|
|
32
|
+
// them find out at build time.
|
|
33
33
|
if (removedSource && options.sourceStillImported) {
|
|
34
|
-
manifest.report('deps', 'bloomer was removed from package.json, but some files still import it
|
|
34
|
+
manifest.report('deps', 'bloomer was removed from package.json, but some files still import it, and installing would leave those imports unresolved: migrate every remaining import of bloomer (the ones the codemod kept are marked `TODO(bestax-migrate)`) before installing, or re-add bloomer until you have');
|
|
35
35
|
}
|
|
36
36
|
addBestax(manifest);
|
|
37
37
|
moveBulmaToV1(manifest, options.bulmaReferenced);
|
|
@@ -59,16 +59,6 @@ export declare const RESPONSIVE_PROPS: Record<string, string | null>;
|
|
|
59
59
|
* regardless. A helper on one of these is named, never converted.
|
|
60
60
|
*/
|
|
61
61
|
export declare const NO_CLASSNAME_TARGETS: Set<string>;
|
|
62
|
-
/**
|
|
63
|
-
* Targets that keep their own class beside a `className` only from a
|
|
64
|
-
* bestax-bulma release, by target. An older release writes the `className`
|
|
65
|
-
* in place of the class that makes the element work, so the transform takes
|
|
66
|
-
* one as a `NO_CLASSNAME_TARGETS` entry unless the run shows the project gets
|
|
67
|
-
* that release (`_shared/bestax-floor.ts`), and as a `HELPERLESS_TARGETS` one
|
|
68
|
-
* when it does. bulma-classes' class map holds the same release as
|
|
69
|
-
* `classNameSince`.
|
|
70
|
-
*/
|
|
71
|
-
export declare const CLASSNAME_SINCE: Readonly<Record<string, string>>;
|
|
72
62
|
export declare const HELPERLESS_TARGETS: Set<string>;
|
|
73
63
|
/** The Bulma class a helper prop stood for, for the hint on those targets. */
|
|
74
64
|
export declare function helperClassHint(name: string, value: string | number | boolean | undefined): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,UAEzB,CAAC;AA8CF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsBtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D,CAAC;AAEF;;;;;GAKG;AACH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,UAEzB,CAAC;AA8CF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsBtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D,CAAC;AAEF;;;;;GAKG;AACH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,kBAAkB,aAoB7B,CAAC;AAEH,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAC3C,MAAM,GAAG,IAAI,CA0Bf;AAED,iFAAiF;AACjF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOlD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA0nBpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiIpD,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAM3E"}
|
|
@@ -133,18 +133,6 @@ export const RESPONSIVE_PROPS = {
|
|
|
133
133
|
* regardless. A helper on one of these is named, never converted.
|
|
134
134
|
*/
|
|
135
135
|
export const NO_CLASSNAME_TARGETS = new Set(['Dropdown.Divider']);
|
|
136
|
-
/**
|
|
137
|
-
* Targets that keep their own class beside a `className` only from a
|
|
138
|
-
* bestax-bulma release, by target. An older release writes the `className`
|
|
139
|
-
* in place of the class that makes the element work, so the transform takes
|
|
140
|
-
* one as a `NO_CLASSNAME_TARGETS` entry unless the run shows the project gets
|
|
141
|
-
* that release (`_shared/bestax-floor.ts`), and as a `HELPERLESS_TARGETS` one
|
|
142
|
-
* when it does. bulma-classes' class map holds the same release as
|
|
143
|
-
* `classNameSince`.
|
|
144
|
-
*/
|
|
145
|
-
export const CLASSNAME_SINCE = {
|
|
146
|
-
'Pagination.Ellipsis': '5.78.4',
|
|
147
|
-
};
|
|
148
136
|
export const HELPERLESS_TARGETS = new Set([
|
|
149
137
|
'Pagination.Previous',
|
|
150
138
|
'Pagination.Next',
|
|
@@ -707,7 +695,8 @@ export const MAPPING = {
|
|
|
707
695
|
PageEllipsis: {
|
|
708
696
|
status: 'mapped',
|
|
709
697
|
target: 'Pagination.Ellipsis',
|
|
710
|
-
// Classes, where the project gets the release in
|
|
698
|
+
// Classes, where the project gets the release `CLASSNAME_SINCE` in
|
|
699
|
+
// `_shared/bestax-floor.ts` names.
|
|
711
700
|
props: {
|
|
712
701
|
isActive: { toClass: 'is-active' },
|
|
713
702
|
isFocused: { toClass: 'is-focused' },
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* (isDisplay / isHidden / Column sizes) → component prop map →
|
|
9
9
|
* universal helper props
|
|
10
10
|
* 3. rewrite imports: drop bloomer, add one merged bestax-bulma import; keep
|
|
11
|
-
* a trimmed bloomer import (with a TODO) only for
|
|
12
|
-
* no bestax equivalent (Tile, the Nav
|
|
11
|
+
* a trimmed bloomer import (with a TODO) only for what another TODO left
|
|
12
|
+
* using it, such as a component with no bestax equivalent (Tile, the Nav
|
|
13
|
+
* family, …)
|
|
13
14
|
*
|
|
14
15
|
* Anything unsafe gets a `// TODO(bestax-migrate)` comment on the enclosing
|
|
15
16
|
* statement plus an entry in the run report.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/transform.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA6DvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAwyBpB"}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* (isDisplay / isHidden / Column sizes) → component prop map →
|
|
9
9
|
* universal helper props
|
|
10
10
|
* 3. rewrite imports: drop bloomer, add one merged bestax-bulma import; keep
|
|
11
|
-
* a trimmed bloomer import (with a TODO) only for
|
|
12
|
-
* no bestax equivalent (Tile, the Nav
|
|
11
|
+
* a trimmed bloomer import (with a TODO) only for what another TODO left
|
|
12
|
+
* using it, such as a component with no bestax equivalent (Tile, the Nav
|
|
13
|
+
* family, …)
|
|
13
14
|
*
|
|
14
15
|
* Anything unsafe gets a `// TODO(bestax-migrate)` comment on the enclosing
|
|
15
16
|
* statement plus an entry in the run report.
|
|
@@ -21,16 +22,15 @@
|
|
|
21
22
|
* and most of them rename onto a dotted bestax compound; the rename and
|
|
22
23
|
* value-reference passes below build those from the mapping's `target`.
|
|
23
24
|
*/
|
|
24
|
-
import {
|
|
25
|
-
import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, literalValueOf, removeAttr, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
25
|
+
import { HELPERLESS_TARGETS, MAPPING, NO_CLASSNAME_TARGETS, UNIVERSAL_PROPS, helperClassHint, resolveMapping, } from './mapping.js';
|
|
26
|
+
import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, literalValueOf, removeAttr, renameElement, replaceChain, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
26
27
|
import { applyPropAction, applyUniversalProps, mergeClass, } from '../_shared/props.js';
|
|
27
28
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
28
29
|
import { keepBaseDisplay } from '../_shared/display.js';
|
|
29
30
|
import { askForModalName } from '../_shared/modal-name.js';
|
|
30
|
-
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
31
|
-
import { bestaxFloorFor } from '../_shared/bestax-floor.js';
|
|
31
|
+
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, noteRetainedImport, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
32
|
+
import { CLASSNAME_SINCE, bestaxFloorFor, classNameWaitsFor, heldForRelease, releaseHoldMessage, makeReferenceHold, releaseRaise, } from '../_shared/bestax-floor.js';
|
|
32
33
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
33
|
-
import { compareVersions } from '../_shared/semver-range.js';
|
|
34
34
|
import { collectBoundNames, makeReserve, nameOf, prefersTabs, resolvesToBinding, } from '../_shared/imports.js';
|
|
35
35
|
import { flattenResponsiveProps, RESPONSIVE_KINDS } from './responsive.js';
|
|
36
36
|
import { runSpecial } from './specials.js';
|
|
@@ -274,23 +274,24 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
274
274
|
// of its class, so a class cannot be written on either: every helper is
|
|
275
275
|
// named instead, and anything else left on the divider would not compile.
|
|
276
276
|
const since = CLASSNAME_SINCE[target];
|
|
277
|
-
const sinceUnmet =
|
|
278
|
-
|
|
279
|
-
//
|
|
280
|
-
|
|
277
|
+
const sinceUnmet = classNameWaitsFor(target, bestaxFloor) !== undefined;
|
|
278
|
+
const raise = releaseRaise(target, since);
|
|
279
|
+
// A `className` of its own, or a spread that may carry one, would
|
|
280
|
+
// replace that class. Keep bloomer's element.
|
|
281
|
+
const held = heldForRelease(element, target, bestaxFloor);
|
|
282
|
+
if (held) {
|
|
283
|
+
ctx.retained.add(sourcePath[0]);
|
|
284
|
+
addTodo(ctx, path, `component:${dotted}`, releaseHoldMessage(target, held, 'bloomer'));
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
281
287
|
if (NO_CLASSNAME_TARGETS.has(target) || sinceUnmet) {
|
|
282
|
-
// A spread may carry
|
|
283
|
-
//
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const ownClass = sinceUnmet &&
|
|
288
|
-
attributesOf(element).some((a) => a.name.name === 'className');
|
|
289
|
-
if (spread || ownClass) {
|
|
288
|
+
// A spread may carry props `Dropdown.Divider` silently ignores, and
|
|
289
|
+
// the codemod cannot read inside it. Keep bloomer's element.
|
|
290
|
+
const spread = NO_CLASSNAME_TARGETS.has(target) &&
|
|
291
|
+
(element.openingElement.attributes ?? []).some((a) => a.type === 'JSXSpreadAttribute');
|
|
292
|
+
if (spread) {
|
|
290
293
|
ctx.retained.add(sourcePath[0]);
|
|
291
|
-
addTodo(ctx, path, `component:${dotted}`,
|
|
292
|
-
? `${raise}, and this element carries ${spread ? 'a spread whose contents the codemod cannot read, where a `className` would replace that class' : 'a `className`, which would replace that class'}, so it stays bloomer's: declare \`@allxsmith/bestax-bulma\` at \`^${since}\` or later and re-run`
|
|
293
|
-
: `bestax \`${target}\` takes no props at all, and this element carries a spread whose contents the codemod cannot read, so it stays bloomer's`);
|
|
294
|
+
addTodo(ctx, path, `component:${dotted}`, `bestax \`${target}\` takes no props at all, and this element carries a spread whose contents the codemod cannot read, so it stays bloomer's`);
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
296
297
|
for (const attr of [...attributesOf(element)]) {
|
|
@@ -404,6 +405,13 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
404
405
|
// generic "referenced as a value" branch, emitting a spurious TODO and
|
|
405
406
|
// marking the root retained when it was not.
|
|
406
407
|
const handledValueRefs = new WeakSet();
|
|
408
|
+
// A reference to a target that waits for a release stays bloomer's.
|
|
409
|
+
const heldReference = makeReferenceHold(ctx, bestaxFloor, 'bloomer', imported => {
|
|
410
|
+
if (imported === '*')
|
|
411
|
+
namespaceStillReferenced = true;
|
|
412
|
+
else
|
|
413
|
+
ctx.retained.add(imported);
|
|
414
|
+
});
|
|
407
415
|
root.find(j.Identifier).forEach(path => {
|
|
408
416
|
// find(Identifier) also matches JSXIdentifier (a subtype) — JSX names
|
|
409
417
|
// were already handled by the element walker above.
|
|
@@ -511,8 +519,10 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
511
519
|
outer.node.property?.type === 'Identifier') {
|
|
512
520
|
memberPath.push(nameOf(outer.node.property));
|
|
513
521
|
const next = outer.parent;
|
|
522
|
+
// Not into `[…]`, which the rebuilt chain would drop.
|
|
514
523
|
if (next?.node?.type === 'MemberExpression' &&
|
|
515
|
-
next.node.object === outer.node
|
|
524
|
+
next.node.object === outer.node &&
|
|
525
|
+
!next.node.computed) {
|
|
516
526
|
outer = next;
|
|
517
527
|
}
|
|
518
528
|
else {
|
|
@@ -528,6 +538,8 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
528
538
|
memberMapping.status !== 'todo' &&
|
|
529
539
|
memberMapping.target &&
|
|
530
540
|
!memberMapping.special) {
|
|
541
|
+
if (heldReference(outer, memberMapping.target, imported))
|
|
542
|
+
return;
|
|
531
543
|
// `B.CardHeaderTitle` → `Card.Header.Title`: the namespace prefix has
|
|
532
544
|
// to go and the target may be dotted, so rebuild the whole chain from
|
|
533
545
|
// the target rather than renaming anything in place.
|
|
@@ -536,7 +548,7 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
536
548
|
for (const part of targetRest) {
|
|
537
549
|
rebuilt = j.memberExpression(rebuilt, j.identifier(part));
|
|
538
550
|
}
|
|
539
|
-
outer
|
|
551
|
+
replaceChain(outer, rebuilt, handledValueRefs);
|
|
540
552
|
ctx.dirty = true;
|
|
541
553
|
return;
|
|
542
554
|
}
|
|
@@ -562,6 +574,11 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
562
574
|
if (shorthandMapping &&
|
|
563
575
|
shorthandMapping.status !== 'todo' &&
|
|
564
576
|
shorthandMapping.target) {
|
|
577
|
+
if (heldReference(path, shorthandMapping.target, imported)) {
|
|
578
|
+
handledValueRefs.add(parentNode.key);
|
|
579
|
+
handledValueRefs.add(parentNode.value);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
565
582
|
const [root, ...rest] = shorthandMapping.target.split('.');
|
|
566
583
|
const local = ctx.reserve(root);
|
|
567
584
|
let value = j.identifier(local);
|
|
@@ -599,6 +616,8 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
599
616
|
// bestax component (`const Old = Icon` → bestax's Icon). Only a
|
|
600
617
|
// target-less special (NavbarItem, Help, …) has nothing to rename to.
|
|
601
618
|
if (mapping && mapping.status !== 'todo' && mapping.target) {
|
|
619
|
+
if (heldReference(path, mapping.target, imported))
|
|
620
|
+
return;
|
|
602
621
|
const [root, ...rest] = mapping.target.split('.');
|
|
603
622
|
const local = ctx.reserve(root);
|
|
604
623
|
if (rest.length > 0) {
|
|
@@ -625,7 +644,6 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
625
644
|
});
|
|
626
645
|
// ---- 3. Rewrite imports -----------------------------------------------
|
|
627
646
|
if (imports.size > 0) {
|
|
628
|
-
const retainedNames = [...ctx.retained].sort((a, b) => a.localeCompare(b));
|
|
629
647
|
const bestaxImport = buildBestaxImport(ctx, bestaxImportState);
|
|
630
648
|
let inserted = false;
|
|
631
649
|
// A retained bloomer specifier must never collide with a bestax import local
|
|
@@ -661,16 +679,7 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
661
679
|
}
|
|
662
680
|
if (keepSpecifiers.length > 0) {
|
|
663
681
|
node.specifiers = keepSpecifiers;
|
|
664
|
-
|
|
665
|
-
// kept solely for a broken default binding has no names to list, and
|
|
666
|
-
// already carries its own "bloomer has no default export" TODO.
|
|
667
|
-
if (retainedNames.length > 0) {
|
|
668
|
-
node.comments = node.comments ?? [];
|
|
669
|
-
const text = ` TODO(bestax-migrate): ${retainedNames.join(', ')} ${retainedNames.length === 1 ? 'has' : 'have'} no bestax-bulma equivalent yet — migrate and remove this import`;
|
|
670
|
-
if (!node.comments.some((c) => c.value === text)) {
|
|
671
|
-
node.comments.push(j.commentLine(text, true, false));
|
|
672
|
-
}
|
|
673
|
-
}
|
|
682
|
+
noteRetainedImport(ctx, path, ctx.retained);
|
|
674
683
|
}
|
|
675
684
|
else {
|
|
676
685
|
carryPrunedComments(node, path, bestaxImportState.existing?.node ?? bestaxImport);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration for an app that styled plain markup with Bulma:
|
|
3
|
-
* bestax-bulma comes in, and nothing goes out.
|
|
4
|
-
*
|
|
3
|
+
* bestax-bulma comes in, and nothing goes out. No package manager is ever
|
|
4
|
+
* invoked.
|
|
5
5
|
*
|
|
6
6
|
* Under the default `--css keep` the app's styling stack is left as it is:
|
|
7
7
|
* converted elements render the same classes, which the app's own Bulma
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration for an app that styled plain markup with Bulma:
|
|
3
|
-
* bestax-bulma comes in, and nothing goes out.
|
|
4
|
-
*
|
|
3
|
+
* bestax-bulma comes in, and nothing goes out. No package manager is ever
|
|
4
|
+
* invoked.
|
|
5
5
|
*
|
|
6
6
|
* Under the default `--css keep` the app's styling stack is left as it is:
|
|
7
7
|
* converted elements render the same classes, which the app's own Bulma
|
|
@@ -272,7 +272,7 @@ const SCRIPT_PATTERNS = [
|
|
|
272
272
|
[
|
|
273
273
|
'carousel',
|
|
274
274
|
/carousel/i,
|
|
275
|
-
"drives a carousel: bestax's `Carousel` takes its slides as `CarouselItem` children and renders its own arrows and indicators (`autoplay` for a timed one); for several slides in view it takes `itemsToShow`, with a variant per viewport such as `itemsToShowMobile`, and `itemsToScroll`, bulma-carousel's `slidesToShow` and `slidesToScroll`; it loops unless `repeat={false}`, where bulma-carousel stops at the ends unless `loop` or `infinite` is set; its styles ship in bestax's `extras.css` and `bestax.css`, not in Bulma's stylesheet",
|
|
275
|
+
"drives a carousel: bestax's `Carousel` takes its slides as `CarouselItem` children and renders its own arrows and indicators (`autoplay` for a timed one, with `rotationControl` for a button that stops it); for several slides in view it takes `itemsToShow`, with a variant per viewport such as `itemsToShowMobile`, and `itemsToScroll`, bulma-carousel's `slidesToShow` and `slidesToScroll`; it loops unless `repeat={false}`, where bulma-carousel stops at the ends unless `loop` or `infinite` is set; its styles ship in bestax's `extras.css` and `bestax.css`, not in Bulma's stylesheet",
|
|
276
276
|
],
|
|
277
277
|
[
|
|
278
278
|
'theme',
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration: swap rbx for @allxsmith/bestax-bulma and clear out
|
|
3
|
-
* the stylesheet dependencies rbx dragged in with it.
|
|
4
|
-
*
|
|
5
|
-
* tells the user to install).
|
|
3
|
+
* the stylesheet dependencies rbx dragged in with it. No package manager is
|
|
4
|
+
* ever invoked (the report tells the user to install).
|
|
6
5
|
*
|
|
7
6
|
* This is the step with the biggest visible payoff for an rbx app. Unlike
|
|
8
7
|
* react-bulma-components, which peer-depends on Bulma and lets the app pick a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/deps.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAwBzD,eAAO,MAAM,kBAAkB,EAAE,kBAiGhC,CAAC"}
|
package/dist/sources/rbx/deps.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* package.json migration: swap rbx for @allxsmith/bestax-bulma and clear out
|
|
3
|
-
* the stylesheet dependencies rbx dragged in with it.
|
|
4
|
-
*
|
|
5
|
-
* tells the user to install).
|
|
3
|
+
* the stylesheet dependencies rbx dragged in with it. No package manager is
|
|
4
|
+
* ever invoked (the report tells the user to install).
|
|
6
5
|
*
|
|
7
6
|
* This is the step with the biggest visible payoff for an rbx app. Unlike
|
|
8
7
|
* react-bulma-components, which peer-depends on Bulma and lets the app pick a
|
|
@@ -66,13 +65,14 @@ export const updateDependencies = (filePath, pkg, collector, options) => {
|
|
|
66
65
|
// rbx pinned Bulma 0.7.5 as a direct dependency, so the bump almost always
|
|
67
66
|
// fires.
|
|
68
67
|
const bulma = moveBulmaToV1(manifest, options.bulmaReferenced);
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
// so say so rather than letting them find out
|
|
68
|
+
// Files can still import rbx after the run: a trimmed import the transform
|
|
69
|
+
// kept, so a partially migrated app still runs, one it couldn't rewrite, a
|
|
70
|
+
// file it couldn't parse or doesn't read (`.vue`, `.astro`). Removing the
|
|
71
|
+
// package from the manifest strands those imports once the user runs the
|
|
72
|
+
// install the report asks for, so say so rather than letting them find out
|
|
73
|
+
// at build time.
|
|
74
74
|
if (removed.includes('rbx') && options.sourceStillImported) {
|
|
75
|
-
manifest.report('deps', 'rbx was removed from package.json, but some files still import it
|
|
75
|
+
manifest.report('deps', 'rbx was removed from package.json, but some files still import it, and installing would leave those imports unresolved: migrate every remaining import of rbx (the ones the codemod kept are marked `TODO(bestax-migrate)`) before installing, or re-add rbx until you have');
|
|
76
76
|
}
|
|
77
77
|
// The headline result: rbx pinned Bulma 0.7.5 as a DIRECT dependency, so
|
|
78
78
|
// removing rbx is what frees the app to choose its own Bulma version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD,eAAO,MAAM,GAAG,EAAE,eAWjB,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { readBestaxPackages } from '../_shared/bestax-floor.js';
|
|
1
2
|
import transform from './transform.js';
|
|
2
3
|
import { transformStyles } from './styles.js';
|
|
3
4
|
import { updateDependencies } from './deps.js';
|
|
4
5
|
export const rbx = {
|
|
5
6
|
name: 'rbx',
|
|
6
7
|
label: 'rbx (v2) → @allxsmith/bestax-bulma',
|
|
8
|
+
// Which bestax-bulma each package gets, for `Pagination.Ellipsis`'s
|
|
9
|
+
// className.
|
|
10
|
+
analyzeProject: targets => ({
|
|
11
|
+
bestaxPackages: readBestaxPackages(targets),
|
|
12
|
+
}),
|
|
7
13
|
transform,
|
|
8
14
|
transformStyles,
|
|
9
15
|
updateDependencies,
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* 2. per-element: structural special → rename → responsive flattening →
|
|
8
8
|
* component prop map → universal helper props → badge/tooltip wrapping
|
|
9
9
|
* 3. rewrite imports: drop rbx, add one merged bestax-bulma import; keep a
|
|
10
|
-
* trimmed rbx import (with a TODO) only for
|
|
11
|
-
* bestax equivalent (Generic,
|
|
10
|
+
* trimmed rbx import (with a TODO) only for what another TODO left
|
|
11
|
+
* using it, such as a component with no bestax equivalent (Generic,
|
|
12
|
+
* Tile, List, …)
|
|
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/rbx/transform.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAkEvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAuiCpB"}
|