@patternfly/documentation-framework 6.36.8 → 6.38.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/CHANGELOG.md +22 -0
- package/components/index.js +1 -1
- package/components/link/{link.js → link.jsx} +1 -1
- package/components/sectionGallery/{sectionDataListLayout.js → sectionDataListLayout.jsx} +2 -2
- package/components/sectionGallery/sectionGallery.js +1 -78
- package/components/sectionGallery/sectionGallery.jsx +78 -0
- package/components/sectionGallery/{sectionGalleryLayout.js → sectionGalleryLayout.jsx} +1 -1
- package/components/sideNav/sideNav.js +1 -1
- package/layouts/sideNavLayout/sideNavLayout.js +5 -3
- package/package.json +7 -7
- package/scripts/md/mdx-hast-to-jsx.js +4 -1
- package/scripts/md/stripReactTypeOnlyImports.js +227 -0
- package/templates/design-guidelines.js +1 -1
- package/versions.json +28 -1
- /package/components/sectionGallery/{TextSummary.js → TextSummary.jsx} +0 -0
- /package/components/sectionGallery/{sectionGalleryToolbar.js → sectionGalleryToolbar.jsx} +0 -0
- /package/components/sectionGallery/{sectionGalleryWrapper.js → sectionGalleryWrapper.jsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 6.38.0 (2026-04-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **site:** update doc-core to 1.22.0 ([#4946](https://github.com/patternfly/patternfly-org/issues/4946)) ([fc290d0](https://github.com/patternfly/patternfly-org/commit/fc290d030bc34d1728fc9a3948fed4e5b4be5df3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 6.37.0 (2026-04-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* bump preleases and update screenshots ([#4986](https://github.com/patternfly/patternfly-org/issues/4986)) ([96b5a86](https://github.com/patternfly/patternfly-org/commit/96b5a86cf62be502b202e5c736a161439d2c5710))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## 6.36.8 (2026-03-25)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
package/components/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export * from './propsTable/propsTable';
|
|
|
8
8
|
export * from './navAnnouncementBanner/navAnnouncementBanner';
|
|
9
9
|
export * from './sideNav/sideNav';
|
|
10
10
|
export * from './topNav/topNav';
|
|
11
|
-
export * from './link/link';
|
|
11
|
+
export * from './link/link.jsx';
|
|
12
12
|
export * from './tableOfContents/tableOfContents';
|
|
13
13
|
export * from './inlineAlert/inlineAlert';
|
|
14
14
|
export * from './themeSelector/themeSelector';
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
ContentVariants,
|
|
12
12
|
Label,
|
|
13
13
|
} from "@patternfly/react-core";
|
|
14
|
-
import { Link } from "../link/link";
|
|
15
|
-
import { TextSummary } from "./TextSummary";
|
|
14
|
+
import { Link } from "../link/link.jsx";
|
|
15
|
+
import { TextSummary } from "./TextSummary.jsx";
|
|
16
16
|
|
|
17
17
|
export const SectionDataListLayout = ({
|
|
18
18
|
galleryItems,
|
|
@@ -1,78 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import './sectionGallery.css';
|
|
4
|
-
import { SectionGalleryToolbar } from "./sectionGalleryToolbar";
|
|
5
|
-
import { SectionGalleryLayout } from "./sectionGalleryLayout";
|
|
6
|
-
import { SectionDataListLayout } from "./sectionDataListLayout";
|
|
7
|
-
import { SectionGalleryWrapper } from "./sectionGalleryWrapper";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Helper component returns gallery of items with search toolbar and switchable gallery/data list views.
|
|
11
|
-
* @param {Object} illustrations - Object of preview images mapped to their snake_case item display name
|
|
12
|
-
* @param {string} section - Name of the navigation section to create the gallery within
|
|
13
|
-
* @param {Object} galleryItemsData - Object containing the image location & summary text mapped to the gallery item's hyphenated-name
|
|
14
|
-
* @param {string} [placeholderText=Search by name] - Optional text to be displayed as placeholder for SearchInput
|
|
15
|
-
* @param {string} [countText= items] - Optional text to be displayed after the number of search results
|
|
16
|
-
* @param {string} [initialLayout=grid] - Optional text to indicate whether to default to grid or list layout
|
|
17
|
-
* @param {Boolean} [hasGridText=false] - Optional boolean to toggle text on grid layout cards
|
|
18
|
-
* @param {Boolean} [hasGridImages=false] - Optional boolean to toggle images on grid layout cards
|
|
19
|
-
* @param {Boolean} [hasListText=false] - Optional boolean to toggle text on list layout rows
|
|
20
|
-
* @param {Boolean} [hasListImages=false] - Optional boolean to toggle images on list layout rows
|
|
21
|
-
* @param {Boolean} [isFullWidth=true] - Optional boolean to disable component from exceeding default max-width for page
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
export const SectionGallery = ({
|
|
25
|
-
illustrations,
|
|
26
|
-
section,
|
|
27
|
-
subsection = null,
|
|
28
|
-
includeSubsections = false,
|
|
29
|
-
parseSubsections = false,
|
|
30
|
-
galleryItemsData,
|
|
31
|
-
placeholderText,
|
|
32
|
-
countText,
|
|
33
|
-
initialLayout = "grid",
|
|
34
|
-
hasGridText = false,
|
|
35
|
-
hasGridImages = true,
|
|
36
|
-
hasListText = true,
|
|
37
|
-
hasListImages = true,
|
|
38
|
-
isFullWidth = true,
|
|
39
|
-
onlyShowInGalleryData = false
|
|
40
|
-
}) => (
|
|
41
|
-
<SectionGalleryWrapper
|
|
42
|
-
illustrations={illustrations}
|
|
43
|
-
section={section}
|
|
44
|
-
subsection={subsection}
|
|
45
|
-
includeSubsections={includeSubsections}
|
|
46
|
-
parseSubsections={parseSubsections}
|
|
47
|
-
galleryItemsData={galleryItemsData}
|
|
48
|
-
initialLayout={initialLayout}
|
|
49
|
-
isFullWidth={isFullWidth}
|
|
50
|
-
onlyShowInGalleryData={onlyShowInGalleryData}
|
|
51
|
-
>
|
|
52
|
-
{(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) => (
|
|
53
|
-
<>
|
|
54
|
-
<SectionGalleryToolbar
|
|
55
|
-
galleryItems={sectionGalleryItems}
|
|
56
|
-
searchTerm={searchTerm}
|
|
57
|
-
setSearchTerm={setSearchTerm}
|
|
58
|
-
layoutView={layoutView}
|
|
59
|
-
setLayoutView={setLayoutView}
|
|
60
|
-
placeholderText={placeholderText}
|
|
61
|
-
countText={countText}
|
|
62
|
-
/>
|
|
63
|
-
<SectionGalleryLayout
|
|
64
|
-
galleryItems={sectionGalleryItems}
|
|
65
|
-
layoutView={layoutView}
|
|
66
|
-
hasGridText={hasGridText}
|
|
67
|
-
hasGridImages={hasGridImages}
|
|
68
|
-
/>
|
|
69
|
-
<SectionDataListLayout
|
|
70
|
-
galleryItems={sectionGalleryItems}
|
|
71
|
-
layoutView={layoutView}
|
|
72
|
-
hasListText={hasListText}
|
|
73
|
-
hasListImages={hasListImages}
|
|
74
|
-
/>
|
|
75
|
-
</>
|
|
76
|
-
)}
|
|
77
|
-
</SectionGalleryWrapper>
|
|
78
|
-
);
|
|
1
|
+
export * from './sectionGallery.jsx';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import './sectionGallery.css';
|
|
4
|
+
import { SectionGalleryToolbar } from "./sectionGalleryToolbar.jsx";
|
|
5
|
+
import { SectionGalleryLayout } from "./sectionGalleryLayout.jsx";
|
|
6
|
+
import { SectionDataListLayout } from "./sectionDataListLayout.jsx";
|
|
7
|
+
import { SectionGalleryWrapper } from "./sectionGalleryWrapper.jsx";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper component returns gallery of items with search toolbar and switchable gallery/data list views.
|
|
11
|
+
* @param {Object} illustrations - Object of preview images mapped to their snake_case item display name
|
|
12
|
+
* @param {string} section - Name of the navigation section to create the gallery within
|
|
13
|
+
* @param {Object} galleryItemsData - Object containing the image location & summary text mapped to the gallery item's hyphenated-name
|
|
14
|
+
* @param {string} [placeholderText=Search by name] - Optional text to be displayed as placeholder for SearchInput
|
|
15
|
+
* @param {string} [countText= items] - Optional text to be displayed after the number of search results
|
|
16
|
+
* @param {string} [initialLayout=grid] - Optional text to indicate whether to default to grid or list layout
|
|
17
|
+
* @param {Boolean} [hasGridText=false] - Optional boolean to toggle text on grid layout cards
|
|
18
|
+
* @param {Boolean} [hasGridImages=false] - Optional boolean to toggle images on grid layout cards
|
|
19
|
+
* @param {Boolean} [hasListText=false] - Optional boolean to toggle text on list layout rows
|
|
20
|
+
* @param {Boolean} [hasListImages=false] - Optional boolean to toggle images on list layout rows
|
|
21
|
+
* @param {Boolean} [isFullWidth=true] - Optional boolean to disable component from exceeding default max-width for page
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const SectionGallery = ({
|
|
25
|
+
illustrations,
|
|
26
|
+
section,
|
|
27
|
+
subsection = null,
|
|
28
|
+
includeSubsections = false,
|
|
29
|
+
parseSubsections = false,
|
|
30
|
+
galleryItemsData,
|
|
31
|
+
placeholderText,
|
|
32
|
+
countText,
|
|
33
|
+
initialLayout = "grid",
|
|
34
|
+
hasGridText = false,
|
|
35
|
+
hasGridImages = true,
|
|
36
|
+
hasListText = true,
|
|
37
|
+
hasListImages = true,
|
|
38
|
+
isFullWidth = true,
|
|
39
|
+
onlyShowInGalleryData = false
|
|
40
|
+
}) => (
|
|
41
|
+
<SectionGalleryWrapper
|
|
42
|
+
illustrations={illustrations}
|
|
43
|
+
section={section}
|
|
44
|
+
subsection={subsection}
|
|
45
|
+
includeSubsections={includeSubsections}
|
|
46
|
+
parseSubsections={parseSubsections}
|
|
47
|
+
galleryItemsData={galleryItemsData}
|
|
48
|
+
initialLayout={initialLayout}
|
|
49
|
+
isFullWidth={isFullWidth}
|
|
50
|
+
onlyShowInGalleryData={onlyShowInGalleryData}
|
|
51
|
+
>
|
|
52
|
+
{(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) => (
|
|
53
|
+
<>
|
|
54
|
+
<SectionGalleryToolbar
|
|
55
|
+
galleryItems={sectionGalleryItems}
|
|
56
|
+
searchTerm={searchTerm}
|
|
57
|
+
setSearchTerm={setSearchTerm}
|
|
58
|
+
layoutView={layoutView}
|
|
59
|
+
setLayoutView={setLayoutView}
|
|
60
|
+
placeholderText={placeholderText}
|
|
61
|
+
countText={countText}
|
|
62
|
+
/>
|
|
63
|
+
<SectionGalleryLayout
|
|
64
|
+
galleryItems={sectionGalleryItems}
|
|
65
|
+
layoutView={layoutView}
|
|
66
|
+
hasGridText={hasGridText}
|
|
67
|
+
hasGridImages={hasGridImages}
|
|
68
|
+
/>
|
|
69
|
+
<SectionDataListLayout
|
|
70
|
+
galleryItems={sectionGalleryItems}
|
|
71
|
+
layoutView={layoutView}
|
|
72
|
+
hasListText={hasListText}
|
|
73
|
+
hasListImages={hasListImages}
|
|
74
|
+
/>
|
|
75
|
+
</>
|
|
76
|
+
)}
|
|
77
|
+
</SectionGalleryWrapper>
|
|
78
|
+
);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Label,
|
|
11
11
|
} from '@patternfly/react-core';
|
|
12
12
|
import { navigate } from '@reach/router';
|
|
13
|
-
import { TextSummary } from './TextSummary';
|
|
13
|
+
import { TextSummary } from './TextSummary.jsx';
|
|
14
14
|
|
|
15
15
|
export const SectionGalleryLayout = ({
|
|
16
16
|
galleryItems,
|
|
@@ -265,9 +265,11 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
265
265
|
|
|
266
266
|
const SideBar = (
|
|
267
267
|
<PageSidebar>
|
|
268
|
-
<
|
|
269
|
-
<
|
|
270
|
-
|
|
268
|
+
<div className="pf-v6-c-page__sidebar-main"> {/** TODO: fix with updated React components after https://redhat.atlassian.net/browse/PF-3728 merges */}
|
|
269
|
+
<PageSidebarBody>
|
|
270
|
+
<SideNav navItems={sideNavItems} groupedRoutes={groupedRoutes} />
|
|
271
|
+
</PageSidebarBody>
|
|
272
|
+
</div>
|
|
271
273
|
</PageSidebar>
|
|
272
274
|
);
|
|
273
275
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.38.0",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"webpack-merge": "5.10.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@patternfly/patternfly": "^6.5.0-prerelease.
|
|
72
|
-
"@patternfly/react-code-editor": "^6.5.0-prerelease.
|
|
73
|
-
"@patternfly/react-core": "^6.5.0-prerelease.
|
|
74
|
-
"@patternfly/react-icons": "^6.5.0-prerelease.
|
|
75
|
-
"@patternfly/react-table": "^6.5.0-prerelease.
|
|
71
|
+
"@patternfly/patternfly": "^6.5.0-prerelease.64",
|
|
72
|
+
"@patternfly/react-code-editor": "^6.5.0-prerelease.52",
|
|
73
|
+
"@patternfly/react-core": "^6.5.0-prerelease.49",
|
|
74
|
+
"@patternfly/react-icons": "^6.5.0-prerelease.20",
|
|
75
|
+
"@patternfly/react-table": "^6.5.0-prerelease.50",
|
|
76
76
|
"react": "^17.0.0 || ^18.0.0",
|
|
77
77
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"http-cache-semantics": ">=4.1.1",
|
|
93
93
|
"nanoid": "3.3.8"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "b5d16750cf82ed9a231862c9262eb67eb205cc01"
|
|
96
96
|
}
|
|
@@ -8,6 +8,7 @@ const { parse } = require('@patternfly/ast-helpers');
|
|
|
8
8
|
const { capitalize } = require('../../helpers/capitalize');
|
|
9
9
|
const { slugger } = require('../../helpers/slugger');
|
|
10
10
|
const { liveCodeTypes } = require('../../helpers/liveCodeTypes');
|
|
11
|
+
const { stripReactTypeOnlyImports } = require('./stripReactTypeOnlyImports');
|
|
11
12
|
|
|
12
13
|
// Adapted from https://github.com/mdx-js/mdx/blob/next/packages/mdx/mdx-hast-to-jsx.js
|
|
13
14
|
function toJSX(node, parentNode = {}, options = {}) {
|
|
@@ -69,7 +70,9 @@ function serializeRoot(node, options) {
|
|
|
69
70
|
|
|
70
71
|
const importStatements = groups.import
|
|
71
72
|
.map(node => node.value)
|
|
72
|
-
.map(imp => imp.replace(/(['"])\./g, (_, match) => `${match}${getRelPath()}${path.posix.sep}\.`))
|
|
73
|
+
.map(imp => imp.replace(/(['"])\./g, (_, match) => `${match}${getRelPath()}${path.posix.sep}\.`))
|
|
74
|
+
.map(imp => stripReactTypeOnlyImports(imp))
|
|
75
|
+
.filter(Boolean);
|
|
73
76
|
|
|
74
77
|
// Build array of absolute import paths for relative imports
|
|
75
78
|
const relativeImportsRegex = /(import [^'"]*)['"](?:[\.\/]+(?:node_modules\/)?)(@?(?:(?!\.svg|\.jpe?g|\.png).)+)['"][;?]/gm;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
const { parse } = require('@patternfly/ast-helpers');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript-only names that @types/react declares but the `react` package does not
|
|
5
|
+
* export at runtime. Value-importing them breaks strict ESM linking (e.g. Rspack).
|
|
6
|
+
* @see https://github.com/facebook/react/issues/11503
|
|
7
|
+
*/
|
|
8
|
+
const REACT_TYPE_ONLY_EXPORTS = new Set([
|
|
9
|
+
'AnimationEvent',
|
|
10
|
+
'AriaAttributes',
|
|
11
|
+
'BaseSyntheticEvent',
|
|
12
|
+
'ChangeEvent',
|
|
13
|
+
'ClipboardEvent',
|
|
14
|
+
'ComponentClass',
|
|
15
|
+
'ComponentProps',
|
|
16
|
+
'ComponentPropsWithRef',
|
|
17
|
+
'ComponentPropsWithoutRef',
|
|
18
|
+
'ComponentType',
|
|
19
|
+
'CompositionEvent',
|
|
20
|
+
'CSSProperties',
|
|
21
|
+
'DetailedHTMLProps',
|
|
22
|
+
'Dispatch',
|
|
23
|
+
'DOMAttributes',
|
|
24
|
+
'DragEvent',
|
|
25
|
+
'ElementType',
|
|
26
|
+
'ExoticComponent',
|
|
27
|
+
'FC',
|
|
28
|
+
'FocusEvent',
|
|
29
|
+
'FormEvent',
|
|
30
|
+
'ForwardRefExoticComponent',
|
|
31
|
+
'FunctionComponent',
|
|
32
|
+
'HTMLAttributes',
|
|
33
|
+
'InvalidEvent',
|
|
34
|
+
'JSXElementConstructor',
|
|
35
|
+
'KeyboardEvent',
|
|
36
|
+
'Key',
|
|
37
|
+
'LazyExoticComponent',
|
|
38
|
+
'LegacyRef',
|
|
39
|
+
'MemoExoticComponent',
|
|
40
|
+
'MouseEvent',
|
|
41
|
+
'MutableRefObject',
|
|
42
|
+
'PointerEvent',
|
|
43
|
+
'PropsWithChildren',
|
|
44
|
+
'PropsWithoutRef',
|
|
45
|
+
'PropsWithRef',
|
|
46
|
+
'ReactChangeEvent',
|
|
47
|
+
'ReactChild',
|
|
48
|
+
'ReactElement',
|
|
49
|
+
'ReactFragment',
|
|
50
|
+
'ReactFormEvent',
|
|
51
|
+
'ReactKeyboardEvent',
|
|
52
|
+
'ReactMouseEvent',
|
|
53
|
+
'ReactNode',
|
|
54
|
+
'ReactPointerEvent',
|
|
55
|
+
'ReactPortal',
|
|
56
|
+
'ReactText',
|
|
57
|
+
'Ref',
|
|
58
|
+
'RefAttributes',
|
|
59
|
+
'RefCallback',
|
|
60
|
+
'RefObject',
|
|
61
|
+
'SetStateAction',
|
|
62
|
+
'StyleHTMLAttributes',
|
|
63
|
+
'SVGAttributes',
|
|
64
|
+
'SVGProps',
|
|
65
|
+
'SyntheticEvent',
|
|
66
|
+
'TouchEvent',
|
|
67
|
+
'TransitionEvent',
|
|
68
|
+
'UIEvent',
|
|
69
|
+
'VoidFunctionComponent',
|
|
70
|
+
'VFC',
|
|
71
|
+
'WheelEvent',
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
function specifierImportedName(spec) {
|
|
75
|
+
if (spec.type !== 'ImportSpecifier') {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const id = spec.imported;
|
|
79
|
+
return id.type === 'Identifier' ? id.name : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function importDeclarationToSource(decl, specifiers) {
|
|
83
|
+
const srcLiteral = decl.source.raw || JSON.stringify(decl.source.value);
|
|
84
|
+
if (specifiers.length === 0) {
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const def = specifiers.find((s) => s.type === 'ImportDefaultSpecifier');
|
|
89
|
+
const ns = specifiers.find((s) => s.type === 'ImportNamespaceSpecifier');
|
|
90
|
+
const named = specifiers.filter((s) => s.type === 'ImportSpecifier');
|
|
91
|
+
|
|
92
|
+
if (ns) {
|
|
93
|
+
return `import * as ${ns.local.name} from ${srcLiteral}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const formatNamed = () =>
|
|
97
|
+
named
|
|
98
|
+
.map((sp) => {
|
|
99
|
+
const imp = sp.imported.name;
|
|
100
|
+
const loc = sp.local.name;
|
|
101
|
+
return imp === loc ? loc : `${imp} as ${loc}`;
|
|
102
|
+
})
|
|
103
|
+
.join(', ');
|
|
104
|
+
|
|
105
|
+
if (def && named.length) {
|
|
106
|
+
return `import ${def.local.name}, { ${formatNamed()} } from ${srcLiteral}`;
|
|
107
|
+
}
|
|
108
|
+
if (def) {
|
|
109
|
+
return `import ${def.local.name} from ${srcLiteral}`;
|
|
110
|
+
}
|
|
111
|
+
return `import { ${formatNamed()} } from ${srcLiteral}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function filterReactSpecifiers(decl) {
|
|
115
|
+
if (decl.importKind === 'type') {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
return decl.specifiers.filter((spec) => {
|
|
119
|
+
if (spec.type === 'ImportDefaultSpecifier' || spec.type === 'ImportNamespaceSpecifier') {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (spec.type === 'ImportSpecifier' && spec.importKind === 'type') {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
const name = specifierImportedName(spec);
|
|
126
|
+
if (!name) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return !REACT_TYPE_ONLY_EXPORTS.has(name);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Removes TypeScript-only specifiers from `import … from 'react'` in MDX import blocks.
|
|
135
|
+
* MDX often provides many import lines in a single node; this handles multi-statement programs.
|
|
136
|
+
*/
|
|
137
|
+
function stripReactTypeOnlyImports(importSource) {
|
|
138
|
+
const trimmed = importSource.trim();
|
|
139
|
+
if (!trimmed || !trimmed.includes('react')) {
|
|
140
|
+
return importSource;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const toParse = trimmed.endsWith(';') ? trimmed : `${trimmed};`;
|
|
144
|
+
let ast;
|
|
145
|
+
try {
|
|
146
|
+
ast = parse(toParse);
|
|
147
|
+
} catch {
|
|
148
|
+
return importSource;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (!ast.body.length) {
|
|
152
|
+
return importSource;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const pureImports = ast.body.every((stmt) => stmt.type === 'ImportDeclaration');
|
|
156
|
+
if (!pureImports) {
|
|
157
|
+
return stripSingleImportDeclaration(toParse, trimmed, importSource);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const parts = [];
|
|
161
|
+
for (const stmt of ast.body) {
|
|
162
|
+
if (stmt.type !== 'ImportDeclaration') {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const mod = stmt.source && stmt.source.value;
|
|
166
|
+
if (mod !== 'react') {
|
|
167
|
+
parts.push(toParse.slice(stmt.start, stmt.end));
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const filtered = filterReactSpecifiers(stmt);
|
|
171
|
+
if (filtered.length === 0) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (filtered.length === stmt.specifiers.length) {
|
|
175
|
+
parts.push(toParse.slice(stmt.start, stmt.end));
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const out = importDeclarationToSource(stmt, filtered);
|
|
179
|
+
if (out) {
|
|
180
|
+
parts.push(out.endsWith(';') ? out : `${out};`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (parts.length === 0) {
|
|
185
|
+
return '';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return parts.join('\n');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Previous behavior: one import statement per node. */
|
|
192
|
+
function stripSingleImportDeclaration(toParse, trimmed, importSource) {
|
|
193
|
+
if (toParse.length === 0) {
|
|
194
|
+
return importSource;
|
|
195
|
+
}
|
|
196
|
+
let ast;
|
|
197
|
+
try {
|
|
198
|
+
ast = parse(toParse);
|
|
199
|
+
} catch {
|
|
200
|
+
return importSource;
|
|
201
|
+
}
|
|
202
|
+
if (ast.body.length !== 1 || ast.body[0].type !== 'ImportDeclaration') {
|
|
203
|
+
return importSource;
|
|
204
|
+
}
|
|
205
|
+
const decl = ast.body[0];
|
|
206
|
+
if (decl.source.value !== 'react') {
|
|
207
|
+
return importSource;
|
|
208
|
+
}
|
|
209
|
+
if (decl.importKind === 'type') {
|
|
210
|
+
return '';
|
|
211
|
+
}
|
|
212
|
+
const filtered = filterReactSpecifiers(decl);
|
|
213
|
+
if (filtered.length === decl.specifiers.length) {
|
|
214
|
+
return importSource;
|
|
215
|
+
}
|
|
216
|
+
const out = importDeclarationToSource(decl, filtered);
|
|
217
|
+
if (!out) {
|
|
218
|
+
return '';
|
|
219
|
+
}
|
|
220
|
+
const hadSemicolon = /;\s*$/.test(trimmed);
|
|
221
|
+
return hadSemicolon ? `${out};` : out;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
module.exports = {
|
|
225
|
+
stripReactTypeOnlyImports,
|
|
226
|
+
REACT_TYPE_ONLY_EXPORTS,
|
|
227
|
+
};
|
package/versions.json
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Releases": [
|
|
3
|
+
{
|
|
4
|
+
"name": "6.5.0-prerelease.49",
|
|
5
|
+
"date": "2026-04-06",
|
|
6
|
+
"latest": true,
|
|
7
|
+
"versions": {
|
|
8
|
+
"@patternfly/chatbot": "6.6.0-prerelease.6",
|
|
9
|
+
"@patternfly/patternfly": "6.5.0-prerelease.64",
|
|
10
|
+
"@patternfly/quickstarts": "6.5.0-prerelease.4",
|
|
11
|
+
"@patternfly/react-catalog-view-extension": "6.3.0-prerelease.3",
|
|
12
|
+
"@patternfly/react-charts": "8.5.0-prerelease.18",
|
|
13
|
+
"@patternfly/react-code-editor": "6.5.0-prerelease.52",
|
|
14
|
+
"@patternfly/react-component-groups": "6.4.0-prerelease.17",
|
|
15
|
+
"@patternfly/react-console": "6.1.0-prerelease.3",
|
|
16
|
+
"@patternfly/react-core": "6.5.0-prerelease.49",
|
|
17
|
+
"@patternfly/react-data-view": "6.5.0-prerelease.1",
|
|
18
|
+
"@patternfly/react-drag-drop": "6.5.0-prerelease.50",
|
|
19
|
+
"@patternfly/react-icons": "6.5.0-prerelease.20",
|
|
20
|
+
"@patternfly/react-log-viewer": "6.4.0-prerelease.2",
|
|
21
|
+
"@patternfly/react-styles": "6.5.0-prerelease.15",
|
|
22
|
+
"@patternfly/react-table": "6.5.0-prerelease.50",
|
|
23
|
+
"@patternfly/react-templates": "6.5.0-prerelease.49",
|
|
24
|
+
"@patternfly/react-tokens": "6.5.0-prerelease.14",
|
|
25
|
+
"@patternfly/react-topology": "6.5.0-prerelease.4",
|
|
26
|
+
"@patternfly/react-user-feedback": "6.2.0-prerelease.3",
|
|
27
|
+
"@patternfly/react-virtualized-extension": "6.2.0"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
3
30
|
{
|
|
4
31
|
"name": "6.5.0-prerelease.33",
|
|
5
32
|
"date": "2025-12-10",
|
|
6
|
-
"
|
|
33
|
+
"hidden": true,
|
|
7
34
|
"versions": {
|
|
8
35
|
"@patternfly/patternfly": "6.5.0-prerelease.33",
|
|
9
36
|
"@patternfly/react-catalog-view-extension": "6.3.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|