bestax-migrate 2.26.0 → 2.27.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/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -6
- package/dist/sources/_shared/deps-common.d.ts +2 -0
- package/dist/sources/_shared/deps-common.d.ts.map +1 -1
- package/dist/sources/_shared/deps-common.js +3 -1
- package/dist/sources/bulma-classes/class-map.d.ts +10 -0
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +21 -0
- package/dist/sources/bulma-classes/html-assets.d.ts +87 -0
- package/dist/sources/bulma-classes/html-assets.d.ts.map +1 -0
- package/dist/sources/bulma-classes/html-assets.js +246 -0
- package/dist/sources/bulma-classes/html-rules.d.ts +5 -0
- package/dist/sources/bulma-classes/html-rules.d.ts.map +1 -1
- package/dist/sources/bulma-classes/html-rules.js +14 -2
- package/dist/sources/bulma-classes/html.d.ts +12 -4
- package/dist/sources/bulma-classes/html.d.ts.map +1 -1
- package/dist/sources/bulma-classes/html.js +224 -49
- package/dist/sources/bulma-classes/project.d.ts +10 -2
- package/dist/sources/bulma-classes/project.d.ts.map +1 -1
- package/dist/sources/bulma-classes/project.js +17 -8
- package/dist/sources/rbx/mapping.js +1 -1
- package/dist/sources/react-bulma-components/mapping.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ The codemod uses [jscodeshift](https://github.com/facebook/jscodeshift) to:
|
|
|
59
59
|
- convert props (`renderAs` → `as`, `loading` → `isLoading`, numeric spacing/text sizes → string unions, `textAlign="center"` → `textAlign="centered"`, …)
|
|
60
60
|
- flatten responsive breakpoint objects (`mobile={{ size: 4 }}` → `sizeMobile={4}`) and bloomer's `isDisplay`/`isHidden` strings, arrays and objects (`isHidden="touch"` → `visibilityTouch="hidden"`)
|
|
61
61
|
- 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
|
|
62
|
-
- 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, scripts and inline handlers are left as `html-*` TODOs
|
|
62
|
+
- 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>`
|
|
63
63
|
- restructure patterns bestax models differently (`Table.Container`, Navbar dropdowns, `Form.Help`, icon-font children → `<Icon name=…>`)
|
|
64
64
|
- 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'`
|
|
65
65
|
- 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
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAIV,eAAe,EAEhB,MAAM,YAAY,CAAC;AA2BpB;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,MAAM,EAAE,EACpB,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,MAAM,EAAE,CAwBV;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAkB5D;AAED,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AASD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgDlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBvD;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAEpE;
|
|
1
|
+
{"version":3,"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OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAyBzB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,EAAE,EAAE,KAAK,EACT,aAAa,GAAE,CAAC,EAAE,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAA0B,GAC7E,OAAO,CAAC,IAAI,CAAC,CAqBf;AAYD,wBAAgB,SAAS,CACvB,EAAE,GAAE,KAAkD,GACrD,OAAO,CA+IT"}
|
package/dist/cli.js
CHANGED
|
@@ -234,8 +234,13 @@ function migrateFiles(source, files, reporter, io, options, project) {
|
|
|
234
234
|
const collector = reporter.startFile();
|
|
235
235
|
const extension = extensionOf(file);
|
|
236
236
|
if (source.transformHtml && source.htmlExtensions?.includes(extension)) {
|
|
237
|
-
const
|
|
238
|
-
|
|
237
|
+
const written = migrateHtmlPage(source.transformHtml, file, sourceText, collector, io, { ...options, project });
|
|
238
|
+
// The module is what the app will import from, as a JSX file's output
|
|
239
|
+
// is: one that imports bulma/… needs `bulma` declared.
|
|
240
|
+
if (written !== null && /['"](?:~?bulma\/)/.test(written)) {
|
|
241
|
+
bulmaReferenced = true;
|
|
242
|
+
}
|
|
243
|
+
reporter.finishFile(file, written !== null, collector.entries);
|
|
239
244
|
continue;
|
|
240
245
|
}
|
|
241
246
|
let output;
|
|
@@ -286,7 +291,8 @@ function migrateFiles(source, files, reporter, io, options, project) {
|
|
|
286
291
|
}
|
|
287
292
|
/**
|
|
288
293
|
* One HTML page: its module is written beside it (never over a file already
|
|
289
|
-
* there; the source checks), and the page itself is left as it was.
|
|
294
|
+
* there; the source checks), and the page itself is left as it was. Returns
|
|
295
|
+
* the module, or null when there is none to write.
|
|
290
296
|
*/
|
|
291
297
|
function migrateHtmlPage(transformHtml, file, sourceText, collector, io, options) {
|
|
292
298
|
let result;
|
|
@@ -298,10 +304,10 @@ function migrateHtmlPage(transformHtml, file, sourceText, collector, io, options
|
|
|
298
304
|
}
|
|
299
305
|
catch (error) {
|
|
300
306
|
io.error(chalk.red(`✖ ${file}: ${error.message}`));
|
|
301
|
-
return
|
|
307
|
+
return null;
|
|
302
308
|
}
|
|
303
309
|
if (result.output === null)
|
|
304
|
-
return
|
|
310
|
+
return null;
|
|
305
311
|
if (options.print)
|
|
306
312
|
io.log(result.output);
|
|
307
313
|
if (options.dry) {
|
|
@@ -311,7 +317,7 @@ function migrateHtmlPage(transformHtml, file, sourceText, collector, io, options
|
|
|
311
317
|
fs.writeFileSync(result.outputPath, result.output);
|
|
312
318
|
io.log(chalk.green(`Wrote ${result.outputPath} from ${file}.`));
|
|
313
319
|
}
|
|
314
|
-
return
|
|
320
|
+
return result.output;
|
|
315
321
|
}
|
|
316
322
|
/**
|
|
317
323
|
* HTML pages a folder walk found but `--extensions` left out, reported when
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { TodoCollector } from '../../types.js';
|
|
9
9
|
export declare const BULMA_RANGE = "^1.0.4";
|
|
10
|
+
/** bestax-bulma's optional peer range for Font Awesome. */
|
|
11
|
+
export declare const FONT_AWESOME_PEER_RANGE = "^6.7.2 || ^7.0.0";
|
|
10
12
|
export declare const DEP_SECTIONS: readonly ["dependencies", "devDependencies"];
|
|
11
13
|
type Section = (typeof DEP_SECTIONS)[number];
|
|
12
14
|
export interface Manifest {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps-common.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/deps-common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,eAAO,MAAM,WAAW,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"deps-common.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/deps-common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,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AAY,CA2Bd;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAqBzD;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAexD"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { isPreV1 } from './semver-range.js';
|
|
9
9
|
const BESTAX_RANGE = '^5';
|
|
10
10
|
export const BULMA_RANGE = '^1.0.4';
|
|
11
|
+
/** bestax-bulma's optional peer range for Font Awesome. */
|
|
12
|
+
export const FONT_AWESOME_PEER_RANGE = '^6.7.2 || ^7.0.0';
|
|
11
13
|
// Bulma v1's sass tree uses `color.channel(…)` — needs dart-sass ≥ 1.79.
|
|
12
14
|
const SASS_RANGE = '^1.79.0';
|
|
13
15
|
export const DEP_SECTIONS = ['dependencies', 'devDependencies'];
|
|
@@ -94,7 +96,7 @@ export function reportPeerRanges(manifest) {
|
|
|
94
96
|
for (const name of DEP_SECTIONS) {
|
|
95
97
|
const range = manifest.section(name)?.['@fortawesome/fontawesome-free'];
|
|
96
98
|
if (range && /^[~^]?[0-5](?:[.x]|$)/.test(range.trim())) {
|
|
97
|
-
manifest.report('peer-deps', `@fortawesome/fontawesome-free ${range} predates bestax-bulma's optional peer range (
|
|
99
|
+
manifest.report('peer-deps', `@fortawesome/fontawesome-free ${range} predates bestax-bulma's optional peer range (${FONT_AWESOME_PEER_RANGE}) — upgrade it, or install with \`npm install --legacy-peer-deps\``);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -383,6 +383,16 @@ export declare const FORWARDS_REF: readonly string[];
|
|
|
383
383
|
export declare const WRAPPERS: Readonly<Record<string, string>>;
|
|
384
384
|
/** The wrappers' own props, as `ROOTS` lists them for the components. */
|
|
385
385
|
export declare const WRAPPER_OWN_PROPS: Readonly<Record<string, readonly string[]>>;
|
|
386
|
+
/**
|
|
387
|
+
* Every class Bulma 0.9.4's compiled stylesheet has and v1's does not, read
|
|
388
|
+
* off the two with the class walk `e2e/bulma-classes-vocabulary.test.ts`
|
|
389
|
+
* uses. Under v1 these style nothing: the tiles, `.columns.is-variable`,
|
|
390
|
+
* `.heading`, `.number`, `is-marginless` and `is-paddingless` (v1 spells the
|
|
391
|
+
* last two `marginless` and `paddingless`). That test holds each one absent
|
|
392
|
+
* from the v1 stylesheet bestax depends on; the 0.9 half was read from its
|
|
393
|
+
* published package, which nothing here installs.
|
|
394
|
+
*/
|
|
395
|
+
export declare const REMOVED_IN_V1: readonly string[];
|
|
386
396
|
/** Bulma 0.9 classes v1 dropped, with what replaced them. */
|
|
387
397
|
export declare const LEGACY_09: Readonly<Record<string, string>>;
|
|
388
398
|
/**
|
|
@@ -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,QA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S,CAE1D"}
|
|
@@ -1976,6 +1976,27 @@ export const WRAPPER_OWN_PROPS = {
|
|
|
1976
1976
|
UnorderedList: ['textColor', 'bgColor'],
|
|
1977
1977
|
Figure: ['textColor', 'bgColor'],
|
|
1978
1978
|
};
|
|
1979
|
+
/**
|
|
1980
|
+
* Every class Bulma 0.9.4's compiled stylesheet has and v1's does not, read
|
|
1981
|
+
* off the two with the class walk `e2e/bulma-classes-vocabulary.test.ts`
|
|
1982
|
+
* uses. Under v1 these style nothing: the tiles, `.columns.is-variable`,
|
|
1983
|
+
* `.heading`, `.number`, `is-marginless` and `is-paddingless` (v1 spells the
|
|
1984
|
+
* last two `marginless` and `paddingless`). That test holds each one absent
|
|
1985
|
+
* from the v1 stylesheet bestax depends on; the 0.9 half was read from its
|
|
1986
|
+
* published package, which nothing here installs.
|
|
1987
|
+
*/
|
|
1988
|
+
export const REMOVED_IN_V1 = [
|
|
1989
|
+
'heading',
|
|
1990
|
+
'is-ancestor',
|
|
1991
|
+
'is-child',
|
|
1992
|
+
'is-marginless',
|
|
1993
|
+
'is-paddingless',
|
|
1994
|
+
'is-parent',
|
|
1995
|
+
'is-variable',
|
|
1996
|
+
'is-vertical',
|
|
1997
|
+
'number',
|
|
1998
|
+
'tile',
|
|
1999
|
+
];
|
|
1979
2000
|
/** Bulma 0.9 classes v1 dropped, with what replaced them. */
|
|
1980
2001
|
export const LEGACY_09 = {
|
|
1981
2002
|
tile: 'Bulma v1 removed tiles; rebuild the layout with `Grid` and `Cell` (see the Bulma 0.9 to 1 guide)',
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stylesheets and scripts a Bulma page loads, read from their URLs: what
|
|
3
|
+
* each one is (`html-asset:<kind>`, `ASSET_KINDS` in `html-rules.ts`) and what
|
|
4
|
+
* to do about it now that a component renders the page. Pure: the caller
|
|
5
|
+
* reads the page, decides where a note goes and whether Bulma's stylesheet
|
|
6
|
+
* becomes an import.
|
|
7
|
+
*
|
|
8
|
+
* A message names bestax's component for an extension only where one does
|
|
9
|
+
* what the extension did; each claim here was read off the component.
|
|
10
|
+
*/
|
|
11
|
+
import type { CssMode } from '../../types.js';
|
|
12
|
+
export type Loads = 'stylesheet' | 'script';
|
|
13
|
+
export type Asset =
|
|
14
|
+
/** Bulma's stylesheet; `build` names one of its other builds. */
|
|
15
|
+
{
|
|
16
|
+
kind: 'bulma';
|
|
17
|
+
build: string | null;
|
|
18
|
+
version: string | null;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'font-awesome';
|
|
21
|
+
major: number | null;
|
|
22
|
+
kit: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** `name` is the package, as the URL spells it (`bulma-carousel`). */
|
|
25
|
+
| {
|
|
26
|
+
kind: 'bulma-extension';
|
|
27
|
+
name: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'jquery';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'webfont';
|
|
32
|
+
icons: 'material-icons' | 'material-symbols' | null;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'stylesheet';
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'script';
|
|
37
|
+
};
|
|
38
|
+
export declare function classifyAsset(url: string, loads: Loads): Asset;
|
|
39
|
+
export declare const GUIDE_0_9_TO_1 = "https://bestax.io/docs/guides/getting-started/migration/bulma-0-9-to-1";
|
|
40
|
+
/** A primary color class: `is-primary`, `has-text-primary-dark`, … */
|
|
41
|
+
export declare const PRIMARY_CLASS: RegExp;
|
|
42
|
+
export interface BulmaFacts {
|
|
43
|
+
/** The URL, as the TODO quotes it. */
|
|
44
|
+
quoted: string;
|
|
45
|
+
version: string | null;
|
|
46
|
+
css: CssMode;
|
|
47
|
+
/** Whether the page's markup has a primary color class. */
|
|
48
|
+
usesPrimary: boolean;
|
|
49
|
+
/** Whether the page's module goes into a Next.js app. */
|
|
50
|
+
nextjs?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* What a page's link to Bulma's standard stylesheet leaves to do. Under
|
|
54
|
+
* `keep` it is only reported. Under `bestax` and `bulma` the module imports
|
|
55
|
+
* the stylesheet in its place, so what is left is the move to Bulma 1 (for a
|
|
56
|
+
* page made for an older one, or one whose URL doesn't say) and, under
|
|
57
|
+
* `bestax`, its primary color: nothing at all for a Bulma 1 page with no
|
|
58
|
+
* primary class, which then has no note. A Next.js app is the exception: its
|
|
59
|
+
* Pages Router takes a global stylesheet only in `pages/_app`, so there the
|
|
60
|
+
* module imports none, and the note says where it goes.
|
|
61
|
+
*/
|
|
62
|
+
export declare function bulmaStylesheetMessage(facts: BulmaFacts): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* A link to Bulma's stylesheet for some media only (`print`), which an
|
|
65
|
+
* import, applying to every medium, can't stand for.
|
|
66
|
+
*/
|
|
67
|
+
export declare function bulmaMediaMessage(quoted: string, version: string | null, media: string): string;
|
|
68
|
+
/** One of Bulma's other builds, which no `--css` mode imports for the page. */
|
|
69
|
+
export declare function bulmaBuildMessage(build: string, quoted: string): string;
|
|
70
|
+
export declare function fontAwesomeMessage(asset: Extract<Asset, {
|
|
71
|
+
kind: 'font-awesome';
|
|
72
|
+
}>, quoted: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* The extensions bestax has a component for, by package (a scoped one by its
|
|
75
|
+
* name alone), with the component that does what the extension did.
|
|
76
|
+
*/
|
|
77
|
+
export declare const EXTENSION_COMPONENTS: Readonly<Record<string, string>>;
|
|
78
|
+
export declare function extensionMessage(name: string, quoted: string[], loads: ReadonlySet<Loads>, css: CssMode): string;
|
|
79
|
+
export declare function jqueryMessage(quoted: string): string;
|
|
80
|
+
export declare function webfontMessage(asset: Extract<Asset, {
|
|
81
|
+
kind: 'webfont';
|
|
82
|
+
}>, quoted: string): string;
|
|
83
|
+
/** Where a stylesheet or script is, read beside the page. */
|
|
84
|
+
export type Place = 'beside' | 'missing' | 'elsewhere';
|
|
85
|
+
export declare function stylesheetMessage(quoted: string, place: Place, target: string): string;
|
|
86
|
+
export declare function scriptMessage(quoted: string, place: Place, target: string): string;
|
|
87
|
+
//# sourceMappingURL=html-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-assets.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,KAAK;AACf,iEAAiE;AAC/D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE;AAC9D,sEAAsE;GACpE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,IAAI,CAAC;CACrD,GACD;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AA6CvB,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CA6C9D;AAID,eAAO,MAAM,cAAc,2EAC+C,CAAC;AAO3E,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAmD,CAAC;AAE9E,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC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KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,CAYR;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,CAQR"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stylesheets and scripts a Bulma page loads, read from their URLs: what
|
|
3
|
+
* each one is (`html-asset:<kind>`, `ASSET_KINDS` in `html-rules.ts`) and what
|
|
4
|
+
* to do about it now that a component renders the page. Pure: the caller
|
|
5
|
+
* reads the page, decides where a note goes and whether Bulma's stylesheet
|
|
6
|
+
* becomes an import.
|
|
7
|
+
*
|
|
8
|
+
* A message names bestax's component for an extension only where one does
|
|
9
|
+
* what the extension did; each claim here was read off the component.
|
|
10
|
+
*/
|
|
11
|
+
import { FONT_AWESOME_PEER_RANGE } from '../_shared/deps-common.js';
|
|
12
|
+
/** A URL's path, without its query and fragment. */
|
|
13
|
+
function pathOf(url) {
|
|
14
|
+
return url.trim().replace(/[?#].*$/, '');
|
|
15
|
+
}
|
|
16
|
+
function hostOf(url) {
|
|
17
|
+
return url.trim().match(/^(?:[a-z][a-z\d+.-]*:)?\/\/([^/?#]+)/i)?.[1] ?? null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Bulma's own stylesheets: the standard one, and the other builds Bulma 1
|
|
21
|
+
* ships under `css/versions/` and Bulma 0.9 shipped beside it (`bulma-rtl`).
|
|
22
|
+
*/
|
|
23
|
+
const BULMA_BUILD = /(?:^|[/\\])bulma(?:-(rtl|no-dark-mode|no-helpers-prefixed|no-helpers|prefixed))?(?:\.min)?\.css$/i;
|
|
24
|
+
/** `bulma@0.9.4` (npm CDNs) and `bulma/0.9.4/` (cdnjs). */
|
|
25
|
+
const BULMA_VERSION = /(?:^|[/@])bulma(?:@|\/)v?(\d+(?:\.\d+){0,2})(?=\/|$)/i;
|
|
26
|
+
const FONT_AWESOME = /font-?awesome/i;
|
|
27
|
+
const FONT_AWESOME_MAJOR = [
|
|
28
|
+
/(?:fontawesome-(?:free|pro)|font-awesome)(?:@|\/)v?(\d+)/i,
|
|
29
|
+
/fontawesome\.com\/releases\/v(\d+)/i,
|
|
30
|
+
];
|
|
31
|
+
const FONT_AWESOME_KIT = /(?:^|\/\/)kit\.fontawesome\.com\//i;
|
|
32
|
+
/** A package whose name starts `bulma-`, as a path segment or a file. */
|
|
33
|
+
const EXTENSION = /(?:^|[/\\])((?:@creativebulma\/)?bulma-[a-z\d]+(?:-[a-z\d]+)*)(?=@|[/\\]|(?:\.min)?\.(?:css|js)$)/i;
|
|
34
|
+
/** jQuery itself, not a plugin: `jquery-3.7.1.min.js`, `jquery@3`. */
|
|
35
|
+
const JQUERY = /(?:^|[/\\])jquery(?:-\d+(?:\.\d+)*)?(?:\.slim)?(?:\.min)?\.js$|(?:^|\/)jquery@[\d.]+$/i;
|
|
36
|
+
/** Hosts that serve a web font's stylesheet. */
|
|
37
|
+
const WEBFONT_HOSTS = new Set([
|
|
38
|
+
'fonts.googleapis.com',
|
|
39
|
+
'fonts.bunny.net',
|
|
40
|
+
'use.typekit.net',
|
|
41
|
+
'fonts.cdnfonts.com',
|
|
42
|
+
'api.fontshare.com',
|
|
43
|
+
]);
|
|
44
|
+
export function classifyAsset(url, loads) {
|
|
45
|
+
const urlPath = pathOf(url);
|
|
46
|
+
if (loads === 'stylesheet') {
|
|
47
|
+
const build = BULMA_BUILD.exec(urlPath);
|
|
48
|
+
if (build) {
|
|
49
|
+
return {
|
|
50
|
+
kind: 'bulma',
|
|
51
|
+
build: build[1]?.toLowerCase() ?? null,
|
|
52
|
+
version: BULMA_VERSION.exec(urlPath)?.[1] ?? null,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (FONT_AWESOME.test(url)) {
|
|
57
|
+
const major = FONT_AWESOME_MAJOR.map(pattern => pattern.exec(urlPath)).find(Boolean)?.[1];
|
|
58
|
+
return {
|
|
59
|
+
kind: 'font-awesome',
|
|
60
|
+
major: major === undefined ? null : Number(major),
|
|
61
|
+
kit: FONT_AWESOME_KIT.test(url.trim()),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const extension = EXTENSION.exec(urlPath)?.[1];
|
|
65
|
+
if (extension)
|
|
66
|
+
return { kind: 'bulma-extension', name: extension };
|
|
67
|
+
if (loads === 'script') {
|
|
68
|
+
return JQUERY.test(urlPath) ? { kind: 'jquery' } : { kind: 'script' };
|
|
69
|
+
}
|
|
70
|
+
const host = hostOf(url)?.toLowerCase();
|
|
71
|
+
if (host && WEBFONT_HOSTS.has(host)) {
|
|
72
|
+
let family = url.replace(/\+/g, ' ');
|
|
73
|
+
try {
|
|
74
|
+
family = decodeURIComponent(family);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// A malformed escape: read the families as written.
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
kind: 'webfont',
|
|
81
|
+
icons: /family=Material Symbols/i.test(family)
|
|
82
|
+
? 'material-symbols'
|
|
83
|
+
: /family=Material Icons/i.test(family)
|
|
84
|
+
? 'material-icons'
|
|
85
|
+
: null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return { kind: 'stylesheet' };
|
|
89
|
+
}
|
|
90
|
+
// ---- Bulma's stylesheet ------------------------------------------------------
|
|
91
|
+
export const GUIDE_0_9_TO_1 = 'https://bestax.io/docs/guides/getting-started/migration/bulma-0-9-to-1';
|
|
92
|
+
/** Whether a version Bulma's URL names is older than 1. */
|
|
93
|
+
function preV1(version) {
|
|
94
|
+
return Number(version.split('.')[0]) < 1;
|
|
95
|
+
}
|
|
96
|
+
/** A primary color class: `is-primary`, `has-text-primary-dark`, … */
|
|
97
|
+
export const PRIMARY_CLASS = /^(?:is|has-text|has-background)-primary(?:-|$)/;
|
|
98
|
+
/**
|
|
99
|
+
* What a page's link to Bulma's standard stylesheet leaves to do. Under
|
|
100
|
+
* `keep` it is only reported. Under `bestax` and `bulma` the module imports
|
|
101
|
+
* the stylesheet in its place, so what is left is the move to Bulma 1 (for a
|
|
102
|
+
* page made for an older one, or one whose URL doesn't say) and, under
|
|
103
|
+
* `bestax`, its primary color: nothing at all for a Bulma 1 page with no
|
|
104
|
+
* primary class, which then has no note. A Next.js app is the exception: its
|
|
105
|
+
* Pages Router takes a global stylesheet only in `pages/_app`, so there the
|
|
106
|
+
* module imports none, and the note says where it goes.
|
|
107
|
+
*/
|
|
108
|
+
export function bulmaStylesheetMessage(facts) {
|
|
109
|
+
const { quoted, version, css, usesPrimary, nextjs = false } = facts;
|
|
110
|
+
const named = version === null ? 'Bulma' : `Bulma ${version}`;
|
|
111
|
+
if (css === 'keep') {
|
|
112
|
+
return `the page loads ${named} from \`${quoted}\`, and a component doesn't: load Bulma once for the app, from its entry (\`import 'bulma/css/bulma.min.css'\`, with \`bulma${version === null ? '' : `@${version}`}\` installed) or a \`<link>\` in its index.html`;
|
|
113
|
+
}
|
|
114
|
+
const said = [];
|
|
115
|
+
if (version === null) {
|
|
116
|
+
said.push(`the URL doesn't say which Bulma it is, so if it predates Bulma 1, read the Bulma 0.9 to 1 guide (${GUIDE_0_9_TO_1}) for what changed`);
|
|
117
|
+
}
|
|
118
|
+
else if (preV1(version)) {
|
|
119
|
+
said.push(`the page was made for ${named}, so read the Bulma 0.9 to 1 guide (${GUIDE_0_9_TO_1}) for what changed`);
|
|
120
|
+
}
|
|
121
|
+
if (css === 'bestax' && usesPrimary) {
|
|
122
|
+
said.push("bestax's bundle builds Bulma with bestax blue as its primary, so the page's primary colors (`is-primary` and its kind) turn from Bulma's turquoise to blue: to keep them, set the `--bulma-primary-*` variables, `--bulma-primary-invert-l` among them (the bestax-migrate skill's `references/css-migration.md` says which), or use `--css bulma`");
|
|
123
|
+
}
|
|
124
|
+
if (nextjs) {
|
|
125
|
+
const target = css === 'bestax'
|
|
126
|
+
? "`import '@allxsmith/bestax-bulma/bestax.css'`"
|
|
127
|
+
: "`import 'bulma/css/bulma.min.css'` (with `bulma` in package.json) and `import '@allxsmith/bestax-bulma/extras.css'`";
|
|
128
|
+
return [
|
|
129
|
+
`the page loads ${named} from \`${quoted}\`, and in a Next.js app a global stylesheet is imported once, from the root layout (App Router) or \`pages/_app\` (Pages Router, which takes one nowhere else), so the module imports none: write ${target} there`,
|
|
130
|
+
...said,
|
|
131
|
+
].join('; and ');
|
|
132
|
+
}
|
|
133
|
+
if (said.length === 0)
|
|
134
|
+
return null;
|
|
135
|
+
const imported = css === 'bestax'
|
|
136
|
+
? "the module imports bestax's bundle in its place (`@allxsmith/bestax-bulma/bestax.css`), which is Bulma 1 with bestax's extras"
|
|
137
|
+
: "the module imports Bulma's stylesheet in its place (`bulma/css/bulma.min.css`, with bestax's `extras.css`), and `--css bulma` moves the app to Bulma 1";
|
|
138
|
+
return `the page loaded ${named} from \`${quoted}\`, and ${imported}: ${said.join('; and ')}`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A link to Bulma's stylesheet for some media only (`print`), which an
|
|
142
|
+
* import, applying to every medium, can't stand for.
|
|
143
|
+
*/
|
|
144
|
+
export function bulmaMediaMessage(quoted, version, media) {
|
|
145
|
+
const named = version === null ? 'Bulma' : `Bulma ${version}`;
|
|
146
|
+
return `the page loads ${named} from \`${quoted}\` for \`media="${media}"\` only, and a component doesn't: load it once for the app from a \`<link>\` in its index.html with the same \`media\`; the codemod writes an import only for a link with no media query, since an import applies to every medium`;
|
|
147
|
+
}
|
|
148
|
+
/** One of Bulma's other builds, which no `--css` mode imports for the page. */
|
|
149
|
+
export function bulmaBuildMessage(build, quoted) {
|
|
150
|
+
return `the page loads Bulma's \`${build}\` build from \`${quoted}\`, and a component doesn't: load it once for the app, from its entry or a \`<link>\` in its index.html; the codemod writes an import only for Bulma's standard stylesheet (bestax's own builds, Bulma with its extras, are under \`@allxsmith/bestax-bulma/versions/\`)`;
|
|
151
|
+
}
|
|
152
|
+
// ---- Font Awesome ------------------------------------------------------------
|
|
153
|
+
const ICON_LOADS_NO_FONT = "bestax's `Icon` loads no font of its own";
|
|
154
|
+
const INSTALL_FONT_AWESOME = `install \`@fortawesome/fontawesome-free\` (bestax-bulma's optional peer range is \`${FONT_AWESOME_PEER_RANGE}\`) and import its \`css/all.min.css\` from the app's entry`;
|
|
155
|
+
export function fontAwesomeMessage(asset, quoted) {
|
|
156
|
+
const { major, kit } = asset;
|
|
157
|
+
if (kit) {
|
|
158
|
+
return `the page loads a Font Awesome kit from \`${quoted}\`, whose version the URL doesn't say: ${ICON_LOADS_NO_FONT}, so keep loading the kit once for the app, from its index.html, or ${INSTALL_FONT_AWESOME}`;
|
|
159
|
+
}
|
|
160
|
+
if (major === null) {
|
|
161
|
+
return `the page loads Font Awesome from \`${quoted}\`, whose version the URL doesn't say: ${ICON_LOADS_NO_FONT} and writes the classes Font Awesome 5 and later read (\`fas fa-<name>\`), so keep loading it once for the app, or ${INSTALL_FONT_AWESOME}, with \`css/v4-shims.min.css\` beside it if the page's names are Font Awesome 4's (\`fa fa-<name>\`)`;
|
|
162
|
+
}
|
|
163
|
+
const loads = `the page loads Font Awesome ${major} from \`${quoted}\``;
|
|
164
|
+
if (major <= 4) {
|
|
165
|
+
return `${loads}, whose classes are \`fa fa-<name>\`, and bestax's \`Icon\` writes \`fas fa-<name>\`, which ${major} doesn't style: ${INSTALL_FONT_AWESOME}, then either import \`css/v4-shims.min.css\` beside it, so the page's ${major} names keep working, or move them to the current names (\`fa-envelope-o\` is \`envelope\` with \`variant="regular"\`)`;
|
|
166
|
+
}
|
|
167
|
+
if (major === 5) {
|
|
168
|
+
return `${loads}: ${ICON_LOADS_NO_FONT} and writes the \`fas fa-<name>\` classes 5 reads, so the \`<link>\` keeps working from the app's index.html; installed from npm, \`@fortawesome/fontawesome-free\` takes 6 or 7 (bestax-bulma's optional peer range is \`${FONT_AWESOME_PEER_RANGE}\`, and an older one fails \`npm install\` with ERESOLVE), which still read the 5 names`;
|
|
169
|
+
}
|
|
170
|
+
if (major <= 7) {
|
|
171
|
+
return `${loads}: ${ICON_LOADS_NO_FONT}, so keep loading it once for the app, from a \`<link>\` in its index.html, or ${INSTALL_FONT_AWESOME}`;
|
|
172
|
+
}
|
|
173
|
+
return `${loads}: ${ICON_LOADS_NO_FONT}, and bestax-bulma's optional peer range for it is \`${FONT_AWESOME_PEER_RANGE}\`, so keep loading this one from a \`<link>\` in the app's index.html, where no peer range applies`;
|
|
174
|
+
}
|
|
175
|
+
// ---- Bulma extensions --------------------------------------------------------
|
|
176
|
+
/**
|
|
177
|
+
* The extensions bestax has a component for, by package (a scoped one by its
|
|
178
|
+
* name alone), with the component that does what the extension did.
|
|
179
|
+
*/
|
|
180
|
+
export const EXTENSION_COMPONENTS = {
|
|
181
|
+
'bulma-accordion': '`Collapses`, with a `Collapse` for each item',
|
|
182
|
+
'bulma-badge': '`Badge`',
|
|
183
|
+
'bulma-calendar': '`DateInput` (and `TimeInput`, `DateTimeInput` and `DateRangeInput`)',
|
|
184
|
+
'bulma-carousel': '`Carousel`, with a `CarouselItem` for each slide',
|
|
185
|
+
'bulma-checkradio': '`Checkbox` and `Radio`, which draw their own box',
|
|
186
|
+
'bulma-collapsible': '`Collapse` (`Collapses` for an accordion)',
|
|
187
|
+
'bulma-pageloader': '`Loading` (`isFullPage` for one over the whole page)',
|
|
188
|
+
'bulma-quickview': '`Sidebar`',
|
|
189
|
+
'bulma-slider': '`Slider`',
|
|
190
|
+
'bulma-steps': '`Steps`',
|
|
191
|
+
'bulma-switch': '`Switch`',
|
|
192
|
+
'bulma-tagsinput': '`Taginput`',
|
|
193
|
+
'bulma-timeline': '`Timeline`',
|
|
194
|
+
'bulma-toast': '`Toast` (`toast.show()` from code, with a `ToastContainer` rendered once)',
|
|
195
|
+
'bulma-tooltip': '`Tooltip`',
|
|
196
|
+
};
|
|
197
|
+
export function extensionMessage(name, quoted, loads, css) {
|
|
198
|
+
const from = `from ${quoted.map(url => `\`${url}\``).join(' and ')}`;
|
|
199
|
+
const bare = name.replace(/^@[^/]+\//, '').toLowerCase();
|
|
200
|
+
if (bare === 'bulma-social') {
|
|
201
|
+
return `the page loads bulma-social, a Bulma extension for brand-colored buttons, ${from}, and bestax has no component for it: keep loading it once for the app (\`bulma-social\` from npm, imported from its entry, or the \`<link>\` in its index.html), since its classes (\`is-twitter\`, \`is-github\` and the rest) style Bulma's \`.button\`, which bestax's \`Button\` renders, so they go on \`Button\` through \`className\``;
|
|
202
|
+
}
|
|
203
|
+
if (bare === 'bulma-extensions') {
|
|
204
|
+
return `the page loads bulma-extensions, a bundle of Bulma extensions, ${from}: bestax has components for several of them (the bestax-migrate skill's \`references/bulma-classes/unmappables.md\` lists which), so render those in place of the extensions' markup and scripts, and keep loading the bundle only while the app still uses one bestax has no component for`;
|
|
205
|
+
}
|
|
206
|
+
const component = EXTENSION_COMPONENTS[bare];
|
|
207
|
+
if (component) {
|
|
208
|
+
return `the page loads ${name}, a Bulma extension, ${from}, and bestax has a component for what it does: ${component}, whose styles ship in bestax's \`extras.css\` and \`bestax.css\`; render that in place of the extension's markup${loads.has('script') ? ' and script' : ''}, and stop loading the extension once nothing the app keeps uses its classes`;
|
|
209
|
+
}
|
|
210
|
+
return `the page loads ${name}, a Bulma extension, ${from}, and a component doesn't: keep loading it once for the app (from npm, imported from its entry, or a \`<link>\` in its index.html) while the page's markup uses its classes, which go on bestax's components through \`className\`${css === 'keep' ? '' : ', and check it works with Bulma 1, which an extension can predate'}`;
|
|
211
|
+
}
|
|
212
|
+
// ---- Everything else ---------------------------------------------------------
|
|
213
|
+
export function jqueryMessage(quoted) {
|
|
214
|
+
return `the page loads jQuery from \`${quoted}\`, and a component runs no page scripts: React renders the page now, so what the page's scripts did with jQuery (toggling classes, handlers, showing and hiding) becomes state and event props in the component; load jQuery in the app only if a library the app keeps still needs it`;
|
|
215
|
+
}
|
|
216
|
+
export function webfontMessage(asset, quoted) {
|
|
217
|
+
if (asset.icons !== null) {
|
|
218
|
+
const name = asset.icons === 'material-icons'
|
|
219
|
+
? "Google's Material Icons"
|
|
220
|
+
: "Google's Material Symbols";
|
|
221
|
+
return `the page loads ${name}, an icon font, from \`${quoted}\`: bestax's \`Icon\` writes its classes with \`library="${asset.icons}"\` and loads no font of its own, so keep the \`<link>\` in the app's index.html, or install the \`${asset.icons}\` package and import its stylesheet from the entry`;
|
|
222
|
+
}
|
|
223
|
+
return `the page loads a web font's stylesheet from \`${quoted}\`, and a component doesn't: keep the \`<link>\` in the app's index.html, with the preconnects that go with it, or self-host the font and import it from the app's entry`;
|
|
224
|
+
}
|
|
225
|
+
export function stylesheetMessage(quoted, place, target) {
|
|
226
|
+
if (place === 'beside') {
|
|
227
|
+
// Beside the page is inside its folder, so this never climbs out of it.
|
|
228
|
+
const specifier = `./${target.replace(/^(?:\.\/)+/, '')}`;
|
|
229
|
+
return `the page's own stylesheet \`${quoted}\` is beside it, and a component doesn't load it: import it once for the app, in the order the page loads it, so its rules still win over Bulma's where they did (a module beside the page imports it as \`${specifier}\`), or move its rules into the app's stylesheet`;
|
|
230
|
+
}
|
|
231
|
+
// Only what the page's folder shows: a `<base href>` may have sent the
|
|
232
|
+
// browser somewhere else, so nothing here says the page never loaded it.
|
|
233
|
+
if (place === 'missing') {
|
|
234
|
+
return `the page loads the stylesheet \`${quoted}\`, which isn't beside the page (no \`${target}\` in its folder): load the stylesheet it meant once for the app, or drop it`;
|
|
235
|
+
}
|
|
236
|
+
return `the page loads the stylesheet \`${quoted}\`, and a component doesn't: load it once for the app, from its entry or a \`<link>\` in its index.html`;
|
|
237
|
+
}
|
|
238
|
+
export function scriptMessage(quoted, place, target) {
|
|
239
|
+
if (place === 'beside') {
|
|
240
|
+
return `the page's own script \`${quoted}\` is beside it, and a component runs no page scripts: port what it does into the component (state, effects, event handlers); its code is still in \`${target}\``;
|
|
241
|
+
}
|
|
242
|
+
if (place === 'missing') {
|
|
243
|
+
return `the page loads the script \`${quoted}\`, which isn't beside the page (no \`${target}\` in its folder): find the one it meant and port what it does into the component, or drop it`;
|
|
244
|
+
}
|
|
245
|
+
return `the page loads the script \`${quoted}\`, and a component runs no page scripts: load it in the app if the app still needs it, or replace what it does with React code`;
|
|
246
|
+
}
|
|
@@ -20,6 +20,11 @@ export declare const NAVBAR_FIXED_CLASSES: readonly string[];
|
|
|
20
20
|
export declare const THEME_CLASSES: readonly string[];
|
|
21
21
|
/** The patterns an inline script is checked for, each with its own recipe. */
|
|
22
22
|
export declare const SCRIPT_PATTERNS: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* What a stylesheet or script the page loads is: Bulma's own stylesheet,
|
|
25
|
+
* Font Awesome, a Bulma extension, jQuery, a web font, or any other.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ASSET_KINDS: readonly string[];
|
|
23
28
|
export declare const HTML_KINDS: ReadonlySet<string>;
|
|
24
29
|
/** Whether a token is one an id of this kind may carry. */
|
|
25
30
|
export declare function inHtmlVocabulary(kind: string, token: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EASjD,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAkC,CAAC;AAE9E,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAO5C,CAAC;
|
|
1
|
+
{"version":3,"file":"html-rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EASjD,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAkC,CAAC;AAE9E,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAO5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAQxC,CAAC;AAoCF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAAoC,CAAC;AAKhF,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAErE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/D"}
|
|
@@ -38,14 +38,26 @@ export const SCRIPT_PATTERNS = [
|
|
|
38
38
|
'modal',
|
|
39
39
|
'theme',
|
|
40
40
|
];
|
|
41
|
+
/**
|
|
42
|
+
* What a stylesheet or script the page loads is: Bulma's own stylesheet,
|
|
43
|
+
* Font Awesome, a Bulma extension, jQuery, a web font, or any other.
|
|
44
|
+
*/
|
|
45
|
+
export const ASSET_KINDS = [
|
|
46
|
+
'bulma',
|
|
47
|
+
'bulma-extension',
|
|
48
|
+
'font-awesome',
|
|
49
|
+
'jquery',
|
|
50
|
+
'script',
|
|
51
|
+
'stylesheet',
|
|
52
|
+
'webfont',
|
|
53
|
+
];
|
|
41
54
|
/** Every HTML event-handler attribute, as written (`onclick`). */
|
|
42
55
|
const EVENT_ATTRIBUTES = Object.values(html.property)
|
|
43
56
|
.map(info => info.attribute)
|
|
44
57
|
.filter(attribute => /^on[a-z]+$/.test(attribute));
|
|
45
58
|
const VOCABULARY = {
|
|
46
59
|
'html-head': new Set(['title', 'meta', 'link', 'style', 'base']),
|
|
47
|
-
|
|
48
|
-
'html-asset': new Set(),
|
|
60
|
+
'html-asset': new Set(ASSET_KINDS),
|
|
49
61
|
'html-script': new Set(SCRIPT_PATTERNS),
|
|
50
62
|
'html-document': new Set([
|
|
51
63
|
...NAVBAR_FIXED_CLASSES,
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
* What a component can't carry becomes a `TODO(bestax-migrate)` line and a
|
|
12
12
|
* report entry under the `html-*` rules (`html-rules.ts`): the head, the
|
|
13
13
|
* `<html>` and `<body>` attributes, scripts (dropped, since a component runs
|
|
14
|
-
* none; their code stays in the page),
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* its
|
|
14
|
+
* none; their code stays in the page), the stylesheets and scripts it loads
|
|
15
|
+
* (`html-assets.ts` says what each is), and what the converter couldn't
|
|
16
|
+
* write as it was. Document-level ones sit above the component, the rest
|
|
17
|
+
* above its `return`, where the planner's own go. A report entry names the
|
|
18
|
+
* page and its line, never the module's.
|
|
19
|
+
*
|
|
20
|
+
* Under `--css bestax` or `--css bulma` the page's link to Bulma's stylesheet
|
|
21
|
+
* becomes `import 'bulma/css/bulma.min.css'` at the top of the module, which
|
|
22
|
+
* the transform's stylesheet pass then retargets exactly as it would in a JSX
|
|
23
|
+
* file, so the CLI's manifest step reads the module the same way too.
|
|
18
24
|
*
|
|
19
25
|
* Nothing is ever overwritten: a module already beside the page stops it
|
|
20
26
|
* (`html-file:exists`), so a second run changes nothing, and the page itself
|
|
@@ -65,6 +71,8 @@ export declare function outputPathFor(file: string, options?: TransformOptions):
|
|
|
65
71
|
* advice names the page's own (`-e html` takes no `.htm` page).
|
|
66
72
|
*/
|
|
67
73
|
export declare function excludedHtml(file: string, source: string): TodoEntry | null;
|
|
74
|
+
/** The import a page's Bulma `<link>` becomes, before `--css` retargets it. */
|
|
75
|
+
export declare const BULMA_IMPORT = "import \"bulma/css/bulma.min.css\";";
|
|
68
76
|
/**
|
|
69
77
|
* The module as written, after the planner: a number attribute on a plain
|
|
70
78
|
* element as a number (`tabIndex="-1"` as `tabIndex={-1}`), which React's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../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C,OAAO,GAAE,gBAAqB,GAC7B,UAAU,CAGZ"}
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
* What a component can't carry becomes a `TODO(bestax-migrate)` line and a
|
|
12
12
|
* report entry under the `html-*` rules (`html-rules.ts`): the head, the
|
|
13
13
|
* `<html>` and `<body>` attributes, scripts (dropped, since a component runs
|
|
14
|
-
* none; their code stays in the page),
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* its
|
|
14
|
+
* none; their code stays in the page), the stylesheets and scripts it loads
|
|
15
|
+
* (`html-assets.ts` says what each is), and what the converter couldn't
|
|
16
|
+
* write as it was. Document-level ones sit above the component, the rest
|
|
17
|
+
* above its `return`, where the planner's own go. A report entry names the
|
|
18
|
+
* page and its line, never the module's.
|
|
19
|
+
*
|
|
20
|
+
* Under `--css bestax` or `--css bulma` the page's link to Bulma's stylesheet
|
|
21
|
+
* becomes `import 'bulma/css/bulma.min.css'` at the top of the module, which
|
|
22
|
+
* the transform's stylesheet pass then retargets exactly as it would in a JSX
|
|
23
|
+
* file, so the CLI's manifest step reads the module the same way too.
|
|
18
24
|
*
|
|
19
25
|
* Nothing is ever overwritten: a module already beside the page stops it
|
|
20
26
|
* (`html-file:exists`), so a second run changes nothing, and the page itself
|
|
@@ -31,8 +37,9 @@ import { childrenOf, isElement, isText, parseHtml, } from '../_shared/html/parse
|
|
|
31
37
|
import { boxOfDisplay, uaDisplay, validInlineDisplay, } from '../_shared/html/whitespace.js';
|
|
32
38
|
import { flaggableRoot } from './class-map.js';
|
|
33
39
|
import { bulmaDisplay, bulmaOutOfFlow, HELPER_DISPLAY } from './display.js';
|
|
40
|
+
import { bulmaBuildMessage, bulmaMediaMessage, bulmaStylesheetMessage, classifyAsset, extensionMessage, fontAwesomeMessage, jqueryMessage, PRIMARY_CLASS, scriptMessage, stylesheetMessage, webfontMessage, } from './html-assets.js';
|
|
34
41
|
import { htmlRuleId, NAVBAR_FIXED_CLASSES, THEME_CLASSES, } from './html-rules.js';
|
|
35
|
-
import { writesTypeScript } from './project.js';
|
|
42
|
+
import { inNextApp, writesTypeScript } from './project.js';
|
|
36
43
|
import transform from './transform.js';
|
|
37
44
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
38
45
|
function attributeOf(element, name) {
|
|
@@ -203,7 +210,8 @@ const JAVASCRIPT_TYPES = /^(?:|module|(?:text|application)\/(?:x-)?(?:javascript
|
|
|
203
210
|
const SCRIPT_PATTERNS = [
|
|
204
211
|
[
|
|
205
212
|
'burger',
|
|
206
|
-
|
|
213
|
+
// Bulma 0.x's docs gave the burger a `burger` class beside its own.
|
|
214
|
+
/navbar-burger|['"`][^'"`\n]*\.burger\b/,
|
|
207
215
|
"toggles the navbar burger: bestax's `Navbar.Burger` takes `active` and `onClick`, and `Navbar.Menu` the same `active`, so keep the open state in `useState` and pass it to both",
|
|
208
216
|
],
|
|
209
217
|
[
|
|
@@ -224,30 +232,40 @@ const SCRIPT_PATTERNS = [
|
|
|
224
232
|
[
|
|
225
233
|
'theme',
|
|
226
234
|
/data-theme|dataset\.theme|theme-(?:dark|light)|prefers-color-scheme/,
|
|
227
|
-
"switches Bulma's light and dark schemes: bestax's `Theme` writes `data-theme` on `<html>` from its `colorMode` (`light`, `dark` or `system`), so keep the choice in state and pass it",
|
|
235
|
+
"switches Bulma's light and dark schemes: bestax's `Theme` writes `data-theme` on `<html>` from its `colorMode` (`light`, `dark` or `system`), so keep the choice in state, saved in `localStorage`, and pass it; `Theme` writes the attribute from an effect, after the first paint, so for a saved choice to paint first, keep a small inline script in the `<head>` of the app's index.html that reads it (or the OS's, with none saved) and writes `data-theme` before the app loads, and start the state from what that script wrote",
|
|
228
236
|
],
|
|
229
237
|
];
|
|
238
|
+
/**
|
|
239
|
+
* The patterns a script beside the page is looked over for. A whole file is
|
|
240
|
+
* more than one inline script, so only the ones that name what they drive.
|
|
241
|
+
*/
|
|
242
|
+
const LOCAL_SCRIPT_PATTERNS = SCRIPT_PATTERNS.filter(([token]) => ['burger', 'carousel', 'theme'].includes(token));
|
|
243
|
+
/** Larger than this, a script beside the page is a bundle, not the page's. */
|
|
244
|
+
const LOCAL_SCRIPT_LIMIT = 256 * 1024;
|
|
230
245
|
const SCRIPT_KEPT = "it was dropped, since a component doesn't run a page's scripts, and its code is still in the page";
|
|
231
|
-
|
|
246
|
+
/** A `media` an import can't stand for: anything but every medium. */
|
|
247
|
+
function forSomeMedia(media) {
|
|
248
|
+
const query = media?.trim().toLowerCase() ?? '';
|
|
249
|
+
return query !== '' && query !== 'all';
|
|
250
|
+
}
|
|
251
|
+
function scriptNotes(script, page) {
|
|
232
252
|
const location = script.sourceCodeLocation;
|
|
233
253
|
const line = location?.startLine ?? null;
|
|
234
254
|
const endLine = location?.endLine;
|
|
235
255
|
const src = attributeOf(script, 'src');
|
|
236
|
-
if (src !== undefined) {
|
|
237
|
-
return [
|
|
238
|
-
{
|
|
239
|
-
rule: htmlRuleId('html-asset'),
|
|
240
|
-
message: `the page loads the script \`${quote(src)}\`, and a component runs no page scripts: load it in the app if the app still needs it, or replace what it does with React code`,
|
|
241
|
-
line,
|
|
242
|
-
},
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
256
|
const type = (attributeOf(script, 'type') ?? '').trim().toLowerCase();
|
|
257
|
+
// A browser loads a `src` only for a script of a JavaScript type; one of
|
|
258
|
+
// any other type (a template, data) is the page's own text, not code.
|
|
259
|
+
if (src !== undefined && JAVASCRIPT_TYPES.test(type)) {
|
|
260
|
+
page.loads.push({ url: src, loads: 'script', line });
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
const kept = src === undefined ? 'still in the page' : `in \`${quote(src)}\``;
|
|
246
264
|
if (type === 'application/ld+json') {
|
|
247
265
|
return [
|
|
248
266
|
{
|
|
249
267
|
rule: htmlRuleId('html-script', 'json-ld'),
|
|
250
|
-
message: `structured data for search engines (JSON-LD) was dropped with the page's scripts: render it where the app sets each page's head, as \`<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }} />\`; the JSON is
|
|
268
|
+
message: `structured data for search engines (JSON-LD) was dropped with the page's scripts: render it where the app sets each page's head, as \`<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }} />\`; the JSON is ${kept}`,
|
|
251
269
|
line,
|
|
252
270
|
endLine,
|
|
253
271
|
},
|
|
@@ -257,7 +275,7 @@ function scriptNotes(script) {
|
|
|
257
275
|
return [
|
|
258
276
|
{
|
|
259
277
|
rule: htmlRuleId('html-script'),
|
|
260
|
-
message: `a \`<script type="${quote(type, 40)}">\` was dropped with the page's scripts: if the page's code reads it (a template, data), move what it holds into the component; it is
|
|
278
|
+
message: `a \`<script type="${quote(type, 40)}">\` was dropped with the page's scripts: if the page's code reads it (a template, data), move what it holds into the component; it is ${kept}`,
|
|
261
279
|
line,
|
|
262
280
|
endLine,
|
|
263
281
|
},
|
|
@@ -283,43 +301,183 @@ function scriptNotes(script) {
|
|
|
283
301
|
}));
|
|
284
302
|
}
|
|
285
303
|
/** Remove every `<script>` from the content, with a note for each. */
|
|
286
|
-
function dropScripts(parent, notes) {
|
|
304
|
+
function dropScripts(parent, notes, page) {
|
|
287
305
|
const nodes = childrenOf(parent);
|
|
288
306
|
for (let i = 0; i < nodes.length; i++) {
|
|
289
307
|
const node = nodes[i];
|
|
290
308
|
if (!isElement(node))
|
|
291
309
|
continue;
|
|
292
310
|
if (node.tagName === 'script' && node.namespaceURI === HTML_NS) {
|
|
293
|
-
notes.push(...scriptNotes(node));
|
|
311
|
+
notes.push(...scriptNotes(node, page));
|
|
294
312
|
nodes.splice(i, 1);
|
|
295
313
|
i--;
|
|
296
314
|
}
|
|
297
315
|
else if (node.tagName !== 'template') {
|
|
298
|
-
dropScripts(node, notes);
|
|
316
|
+
dropScripts(node, notes, page);
|
|
299
317
|
}
|
|
300
318
|
}
|
|
301
319
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
320
|
+
// ---- Stylesheets and scripts it loads --------------------------------------
|
|
321
|
+
/** The import a page's Bulma `<link>` becomes, before `--css` retargets it. */
|
|
322
|
+
export const BULMA_IMPORT = 'import "bulma/css/bulma.min.css";';
|
|
323
|
+
/**
|
|
324
|
+
* Where a relative URL points, read beside the page: a file there, nothing
|
|
325
|
+
* there, or somewhere the page's folder can't say: any other URL, one a
|
|
326
|
+
* `../` takes out of the page's folder (which isn't beside it, and isn't
|
|
327
|
+
* the codemod's to open), and one whose path can't be read.
|
|
328
|
+
*/
|
|
329
|
+
function placeOf(url, dir) {
|
|
330
|
+
const elsewhere = { place: 'elsewhere', target: url };
|
|
331
|
+
if (!isRelative(url))
|
|
332
|
+
return elsewhere;
|
|
333
|
+
const target = urlPath(url);
|
|
334
|
+
const file = path.resolve(dir, target);
|
|
335
|
+
if (path.relative(dir, file).split(/[/\\]/)[0] === '..')
|
|
336
|
+
return elsewhere;
|
|
337
|
+
let stat;
|
|
338
|
+
try {
|
|
339
|
+
stat = fs.statSync(file, { throwIfNoEntry: false });
|
|
312
340
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
341
|
+
catch {
|
|
342
|
+
// A folder on the way that can't be searched (`EACCES`), say.
|
|
343
|
+
return elsewhere;
|
|
344
|
+
}
|
|
345
|
+
return stat?.isFile()
|
|
346
|
+
? { place: 'beside', target }
|
|
347
|
+
: { place: 'missing', target };
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* A script beside the page, looked over the way an inline script is, for
|
|
351
|
+
* the patterns that name what they drive. Null when it can't be read, is too
|
|
352
|
+
* large to be the page's own, or shows none of them.
|
|
353
|
+
*/
|
|
354
|
+
function localScriptNotes(quoted, target, dir, line) {
|
|
355
|
+
let code;
|
|
356
|
+
try {
|
|
357
|
+
const file = path.resolve(dir, target);
|
|
358
|
+
if (fs.statSync(file).size > LOCAL_SCRIPT_LIMIT)
|
|
359
|
+
return null;
|
|
360
|
+
code = fs.readFileSync(file, 'utf8');
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
const found = LOCAL_SCRIPT_PATTERNS.filter(([, pattern]) => pattern.test(code));
|
|
366
|
+
if (found.length === 0)
|
|
367
|
+
return null;
|
|
368
|
+
return found.map(([token, , recipe]) => ({
|
|
369
|
+
rule: htmlRuleId('html-script', token),
|
|
370
|
+
message: `the page's script \`${quoted}\` ${recipe}; a component doesn't load it, and its code is still in \`${target}\``,
|
|
321
371
|
line,
|
|
322
|
-
};
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
/** Whether the page's markup has a primary color class. */
|
|
375
|
+
function usesPrimary(root) {
|
|
376
|
+
return childrenOf(root).some(child => isElement(child) &&
|
|
377
|
+
(classesOf(child).some(token => PRIMARY_CLASS.test(token)) ||
|
|
378
|
+
usesPrimary(child)));
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* The stylesheets and scripts the page loads, as notes: one for each, but
|
|
382
|
+
* one for an extension's stylesheet and script together, since they are one
|
|
383
|
+
* thing to replace. Under `--css bestax` or `--css bulma`, Bulma's standard
|
|
384
|
+
* stylesheet becomes an import in the module (`importsBulma`), which the
|
|
385
|
+
* transform then retargets as it would the same import in a JSX file, and is
|
|
386
|
+
* noted only for what that leaves to do. Not for a link with a media query,
|
|
387
|
+
* which an import can't stand for, nor in a Next.js app, which takes a
|
|
388
|
+
* global stylesheet only in its root layout or `pages/_app`.
|
|
389
|
+
*/
|
|
390
|
+
function assetNotes(page, root) {
|
|
391
|
+
const notes = [];
|
|
392
|
+
const shared = new Map();
|
|
393
|
+
const note = (rule, message, line) => notes.push({ rule, message, line });
|
|
394
|
+
for (const load of page.loads) {
|
|
395
|
+
const asset = classifyAsset(load.url, load.loads);
|
|
396
|
+
const quoted = quote(load.url);
|
|
397
|
+
if (asset.kind === 'bulma' &&
|
|
398
|
+
asset.build === null &&
|
|
399
|
+
forSomeMedia(load.media)) {
|
|
400
|
+
note(htmlRuleId('html-asset', 'bulma'), bulmaMediaMessage(quoted, asset.version, quote(load.media, 40)), load.line);
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
const key = asset.kind === 'bulma-extension'
|
|
404
|
+
? `extension:${asset.name.toLowerCase()}`
|
|
405
|
+
: asset.kind === 'bulma' && asset.build === null
|
|
406
|
+
? 'bulma'
|
|
407
|
+
: null;
|
|
408
|
+
if (key !== null) {
|
|
409
|
+
const group = shared.get(key);
|
|
410
|
+
if (group)
|
|
411
|
+
group.loads.push(load);
|
|
412
|
+
else
|
|
413
|
+
shared.set(key, { asset, loads: [load] });
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
switch (asset.kind) {
|
|
417
|
+
case 'bulma':
|
|
418
|
+
note(htmlRuleId('html-asset', 'bulma'), bulmaBuildMessage(asset.build, quoted), load.line);
|
|
419
|
+
break;
|
|
420
|
+
case 'font-awesome':
|
|
421
|
+
note(htmlRuleId('html-asset', 'font-awesome'), fontAwesomeMessage(asset, quoted), load.line);
|
|
422
|
+
break;
|
|
423
|
+
case 'jquery':
|
|
424
|
+
note(htmlRuleId('html-asset', 'jquery'), jqueryMessage(quoted), load.line);
|
|
425
|
+
break;
|
|
426
|
+
case 'webfont':
|
|
427
|
+
note(htmlRuleId('html-asset', 'webfont'), webfontMessage(asset, quoted), load.line);
|
|
428
|
+
break;
|
|
429
|
+
case 'stylesheet': {
|
|
430
|
+
const { place, target } = placeOf(load.url, page.dir);
|
|
431
|
+
note(htmlRuleId('html-asset', 'stylesheet'), stylesheetMessage(quoted, place, quote(target)), load.line);
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
case 'script': {
|
|
435
|
+
const { place, target } = placeOf(load.url, page.dir);
|
|
436
|
+
const local = place === 'beside'
|
|
437
|
+
? localScriptNotes(quoted, target, page.dir, load.line)
|
|
438
|
+
: null;
|
|
439
|
+
if (local)
|
|
440
|
+
notes.push(...local);
|
|
441
|
+
else {
|
|
442
|
+
note(htmlRuleId('html-asset', 'script'), scriptMessage(quoted, place, quote(target)), load.line);
|
|
443
|
+
}
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
let importsBulma = false;
|
|
449
|
+
for (const { asset, loads } of shared.values()) {
|
|
450
|
+
const lines = [
|
|
451
|
+
...new Set(loads.flatMap(load => (load.line === null ? [] : [load.line]))),
|
|
452
|
+
];
|
|
453
|
+
const quoted = [...new Set(loads.map(load => quote(load.url)))];
|
|
454
|
+
let message;
|
|
455
|
+
let rule;
|
|
456
|
+
if (asset.kind === 'bulma') {
|
|
457
|
+
rule = htmlRuleId('html-asset', 'bulma');
|
|
458
|
+
importsBulma = page.css !== 'keep' && !page.nextjs;
|
|
459
|
+
message = bulmaStylesheetMessage({
|
|
460
|
+
quoted: quoted[0],
|
|
461
|
+
version: asset.version,
|
|
462
|
+
css: page.css,
|
|
463
|
+
usesPrimary: usesPrimary(root),
|
|
464
|
+
nextjs: page.nextjs,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
rule = htmlRuleId('html-asset', 'bulma-extension');
|
|
469
|
+
message = extensionMessage(asset.name, quoted, new Set(loads.map(load => load.loads)), page.css);
|
|
470
|
+
}
|
|
471
|
+
if (message === null)
|
|
472
|
+
continue;
|
|
473
|
+
notes.push({
|
|
474
|
+
rule,
|
|
475
|
+
message,
|
|
476
|
+
line: loads[0].line,
|
|
477
|
+
...(lines.length > 1 ? { lines } : {}),
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return { notes, importsBulma };
|
|
323
481
|
}
|
|
324
482
|
/** What a `<meta>` is for: its `name`, `property`, `http-equiv` or charset. */
|
|
325
483
|
function metaKind(meta) {
|
|
@@ -336,7 +494,7 @@ function listed(values) {
|
|
|
336
494
|
const shown = unique.slice(0, 6).join(', ');
|
|
337
495
|
return unique.length > 6 ? `${shown}, …` : shown;
|
|
338
496
|
}
|
|
339
|
-
function headNotes(head,
|
|
497
|
+
function headNotes(head, notes, page) {
|
|
340
498
|
const metas = [];
|
|
341
499
|
const links = [];
|
|
342
500
|
for (const node of head) {
|
|
@@ -359,7 +517,12 @@ function headNotes(head, css, notes) {
|
|
|
359
517
|
const rel = (attributeOf(node, 'rel') ?? '').toLowerCase().split(/\s+/);
|
|
360
518
|
const href = attributeOf(node, 'href');
|
|
361
519
|
if (rel.includes('stylesheet') && href !== undefined) {
|
|
362
|
-
|
|
520
|
+
page.loads.push({
|
|
521
|
+
url: href,
|
|
522
|
+
loads: 'stylesheet',
|
|
523
|
+
line,
|
|
524
|
+
media: attributeOf(node, 'media'),
|
|
525
|
+
});
|
|
363
526
|
}
|
|
364
527
|
else {
|
|
365
528
|
links.push(node);
|
|
@@ -375,7 +538,7 @@ function headNotes(head, css, notes) {
|
|
|
375
538
|
});
|
|
376
539
|
break;
|
|
377
540
|
case 'script':
|
|
378
|
-
notes.push(...scriptNotes(node));
|
|
541
|
+
notes.push(...scriptNotes(node, page));
|
|
379
542
|
break;
|
|
380
543
|
case 'base':
|
|
381
544
|
notes.push({
|
|
@@ -757,9 +920,11 @@ function todoLine(note, page) {
|
|
|
757
920
|
const message = note.message.replace(/[\r\n\u2028\u2029]+/g, ' ').trim();
|
|
758
921
|
const at = note.line === null
|
|
759
922
|
? ''
|
|
760
|
-
:
|
|
761
|
-
?
|
|
762
|
-
:
|
|
923
|
+
: note.lines !== undefined
|
|
924
|
+
? ` (${page}:${note.lines.join(', ')})`
|
|
925
|
+
: ` (${page}:${note.line}${note.endLine !== undefined && note.endLine > note.line
|
|
926
|
+
? `-${note.endLine}`
|
|
927
|
+
: ''})`;
|
|
763
928
|
return `// TODO(bestax-migrate): ${message}${at}`;
|
|
764
929
|
}
|
|
765
930
|
/** What a shared line says about several relative URLs, by rule. */
|
|
@@ -882,14 +1047,22 @@ export function convertPage(file, source, collector, options = {}) {
|
|
|
882
1047
|
}, outputPath);
|
|
883
1048
|
}
|
|
884
1049
|
const notes = { document: [], content: [] };
|
|
1050
|
+
const context = {
|
|
1051
|
+
dir: path.dirname(file),
|
|
1052
|
+
css: options.cssMode ?? 'keep',
|
|
1053
|
+
nextjs: inNextApp(file, options.packageLanguages),
|
|
1054
|
+
loads: [],
|
|
1055
|
+
};
|
|
885
1056
|
parseNotes(parsed, notes.document);
|
|
886
|
-
headNotes(parsed.head,
|
|
1057
|
+
headNotes(parsed.head, notes.document, context);
|
|
887
1058
|
const body = parsed.kind === 'document' ? parsed.root : null;
|
|
888
1059
|
documentAttributeNotes('html', body?.parentNode && isElement(body.parentNode)
|
|
889
1060
|
? body.parentNode
|
|
890
1061
|
: undefined, notes.document);
|
|
891
1062
|
documentAttributeNotes('body', body ?? undefined, notes.document);
|
|
892
|
-
dropScripts(parsed.root, notes.document);
|
|
1063
|
+
dropScripts(parsed.root, notes.document, context);
|
|
1064
|
+
const assets = assetNotes(context, parsed.root);
|
|
1065
|
+
notes.document.push(...assets.notes);
|
|
893
1066
|
const emitted = emitJsx(parsed.root, {
|
|
894
1067
|
displayOf: pageDisplayOf,
|
|
895
1068
|
indent: 2,
|
|
@@ -905,6 +1078,8 @@ export function convertPage(file, source, collector, options = {}) {
|
|
|
905
1078
|
const lines = [
|
|
906
1079
|
...header,
|
|
907
1080
|
...(header.length > 0 ? [''] : []),
|
|
1081
|
+
// The transform retargets it under `--css`, as it would in a JSX file.
|
|
1082
|
+
...(assets.importsBulma ? [BULMA_IMPORT] : []),
|
|
908
1083
|
...notes.document.map(note => todoLine(note, page)),
|
|
909
1084
|
`export default function ${componentName(file)}() {`,
|
|
910
1085
|
...contentLines(notes.content, page).map(line => ` ${line}`),
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* What the bulma-classes transform needs to know about the project and cannot
|
|
3
3
|
* see from one file: which files a Next.js App Router may render as server
|
|
4
4
|
* components, which packages render JSX through a runtime other than React,
|
|
5
|
-
* and
|
|
5
|
+
* and, for the module an HTML page becomes, which are written in TypeScript
|
|
6
|
+
* and which are Next.js apps, where that module imports no stylesheet.
|
|
6
7
|
*
|
|
7
8
|
* Read once per run, from every package.json the run touches: the nearest one
|
|
8
9
|
* above each target, and every one below it, so a monorepo run from its root
|
|
@@ -26,11 +27,16 @@ export interface ServerComponentRoot {
|
|
|
26
27
|
dir: string;
|
|
27
28
|
except: string[];
|
|
28
29
|
}
|
|
29
|
-
/** A package, and
|
|
30
|
+
/** A package, and what a module it gains should be written for. */
|
|
30
31
|
export interface PackageLanguage {
|
|
31
32
|
dir: string;
|
|
32
33
|
/** It has a `tsconfig.json`, or depends on `typescript`. */
|
|
33
34
|
typescript: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* It depends on `next`, whose Pages Router takes a global stylesheet only
|
|
37
|
+
* in `pages/_app`, so a page's module imports none there.
|
|
38
|
+
*/
|
|
39
|
+
nextjs?: boolean;
|
|
34
40
|
}
|
|
35
41
|
export interface ProjectFacts {
|
|
36
42
|
serverComponentRoots: ServerComponentRoot[];
|
|
@@ -49,4 +55,6 @@ export declare function analyzeProject(targets: string[]): ProjectFacts;
|
|
|
49
55
|
* innermost package around it says, and no when no package does.
|
|
50
56
|
*/
|
|
51
57
|
export declare function writesTypeScript(file: string, languages: unknown): boolean;
|
|
58
|
+
/** Whether the innermost package around `file` is a Next.js app. */
|
|
59
|
+
export declare function inNextApp(file: string, languages: unknown): boolean;
|
|
52
60
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/project.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAK7C,CAAC;AAqBH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IAC5C,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;AA2GD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACjD,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,YAAY,CAuD9D;AAcD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAE1E;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAEnE"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* What the bulma-classes transform needs to know about the project and cannot
|
|
3
3
|
* see from one file: which files a Next.js App Router may render as server
|
|
4
4
|
* components, which packages render JSX through a runtime other than React,
|
|
5
|
-
* and
|
|
5
|
+
* and, for the module an HTML page becomes, which are written in TypeScript
|
|
6
|
+
* and which are Next.js apps, where that module imports no stylesheet.
|
|
6
7
|
*
|
|
7
8
|
* Read once per run, from every package.json the run touches: the nearest one
|
|
8
9
|
* above each target, and every one below it, so a monorepo run from its root
|
|
@@ -206,20 +207,28 @@ export function analyzeProject(targets) {
|
|
|
206
207
|
dir,
|
|
207
208
|
typescript: Boolean(deps.typescript) ||
|
|
208
209
|
fs.existsSync(path.join(dir, 'tsconfig.json')),
|
|
210
|
+
nextjs: Boolean(deps.next),
|
|
209
211
|
});
|
|
210
212
|
}
|
|
211
213
|
return facts;
|
|
212
214
|
}
|
|
215
|
+
/** The innermost package around `file` of those the run read, if any. */
|
|
216
|
+
function packageAround(file, languages) {
|
|
217
|
+
if (!Array.isArray(languages))
|
|
218
|
+
return undefined;
|
|
219
|
+
const resolved = path.resolve(file);
|
|
220
|
+
return languages
|
|
221
|
+
.filter(entry => resolved.startsWith(`${entry.dir}${path.sep}`))
|
|
222
|
+
.sort((a, b) => b.dir.length - a.dir.length)[0];
|
|
223
|
+
}
|
|
213
224
|
/**
|
|
214
225
|
* Whether a new module beside `file` should be TypeScript: what the
|
|
215
226
|
* innermost package around it says, and no when no package does.
|
|
216
227
|
*/
|
|
217
228
|
export function writesTypeScript(file, languages) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
.sort((a, b) => b.dir.length - a.dir.length)[0];
|
|
224
|
-
return found?.typescript ?? false;
|
|
229
|
+
return packageAround(file, languages)?.typescript ?? false;
|
|
230
|
+
}
|
|
231
|
+
/** Whether the innermost package around `file` is a Next.js app. */
|
|
232
|
+
export function inNextApp(file, languages) {
|
|
233
|
+
return packageAround(file, languages)?.nextjs ?? false;
|
|
225
234
|
}
|
|
@@ -129,7 +129,7 @@ export const MAPPING = {
|
|
|
129
129
|
},
|
|
130
130
|
forwardRefAs: {
|
|
131
131
|
status: 'todo',
|
|
132
|
-
todo: '`forwardRefAs` is rbx-internal and has no counterpart. bestax forwards a ref from the form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Timeline`, `Timeline.Item`, `Toast` and `
|
|
132
|
+
todo: '`forwardRefAs` is rbx-internal and has no counterpart. bestax forwards a ref from the form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `TreeView` and `TreeView.Item` — pass `ref` directly on those, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: your rbx `Navbar.Dropdown` is the menu and becomes `Navbar.DropdownMenu`, which forwards no ref, while bestax `Navbar.Dropdown` — the container your `<Navbar.Item dropdown>` becomes — does. The rest, `Box` included, forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a wrapping element you control',
|
|
133
133
|
},
|
|
134
134
|
// ---- elements -----------------------------------------------------------
|
|
135
135
|
Block: { status: 'mapped', target: 'Block' },
|
|
@@ -27,7 +27,7 @@ export const UNIVERSAL_PROPS = {
|
|
|
27
27
|
todo: 'this bestax component has no `as` prop; restructure the element instead',
|
|
28
28
|
},
|
|
29
29
|
domRef: {
|
|
30
|
-
todo: 'bestax-bulma has no `domRef`. The form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Timeline`, `Timeline.Item`, `Toast` and `
|
|
30
|
+
todo: 'bestax-bulma has no `domRef`. The form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `TreeView` and `TreeView.Item` forward a ref — on those, rename `domRef` to `ref`, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: the `Navbar.Item` that wrapped your dropdown became bestax `Navbar.Dropdown` and forwards one, while your `Navbar.Dropdown` became `Navbar.DropdownMenu` and does not. The rest forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a DOM child or wrap the component',
|
|
31
31
|
},
|
|
32
32
|
// ColorProps
|
|
33
33
|
backgroundColor: { rename: 'bgColor' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.0",
|
|
4
4
|
"description": "Codemods for migrating existing React apps from other Bulma libraries to @allxsmith/bestax-bulma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"jscodeshift": "^17.3.0",
|
|
41
41
|
"parse5": "^7.3.0",
|
|
42
42
|
"property-information": "^7.2.0",
|
|
43
|
-
"@allxsmith/bestax-bulma": "^5.
|
|
43
|
+
"@allxsmith/bestax-bulma": "^5.37.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^30.0.0",
|
|
@@ -72,10 +72,11 @@
|
|
|
72
72
|
"validate:corpus:rbx": "pnpm run build && node scripts/validate-corpus-rbx.mjs",
|
|
73
73
|
"validate:corpus:bloomer": "pnpm run build && node scripts/validate-corpus-bloomer.mjs",
|
|
74
74
|
"validate:corpus:bulma-classes": "pnpm run build && node scripts/validate-corpus-bulma-classes.mjs",
|
|
75
|
+
"validate:corpus:templates": "pnpm run build && node scripts/validate-corpus-templates.mjs",
|
|
75
76
|
"format": "prettier --write \"src/**/*.{ts,tsx}\" \"e2e/**/*.ts\"",
|
|
76
77
|
"format:check": "prettier --check \"src/**/*.{ts,tsx}\" \"e2e/**/*.ts\"",
|
|
77
78
|
"clean": "rimraf dist",
|
|
78
79
|
"release": "npx semantic-release"
|
|
79
80
|
},
|
|
80
|
-
"readme": "# bestax-migrate\n\n[](https://www.npmjs.com/package/bestax-migrate)\n[](https://www.npmjs.com/package/bestax-migrate)\n[](https://opensource.org/licenses/MIT)\n[](https://socket.dev/npm/package/bestax-migrate/overview)\n[](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[](https://www.bestpractices.dev/projects/14361)\n[](https://www.npmjs.com/package/bestax-migrate#provenance)\n[](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, scripts and inline handlers are left as `html-*` TODOs\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 |\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## 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"
|
|
81
|
+
"readme": "# bestax-migrate\n\n[](https://www.npmjs.com/package/bestax-migrate)\n[](https://www.npmjs.com/package/bestax-migrate)\n[](https://opensource.org/licenses/MIT)\n[](https://socket.dev/npm/package/bestax-migrate/overview)\n[](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[](https://www.bestpractices.dev/projects/14361)\n[](https://www.npmjs.com/package/bestax-migrate#provenance)\n[](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 |\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## 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"
|
|
81
82
|
}
|