diff --git a/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md b/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md index 788f4c3a9ec..881cefdc044 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md +++ b/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md @@ -10,16 +10,20 @@ For current development version of Console, use `4.x.0-prerelease.n` packages. For older 1.x plugin SDK packages, refer to "OpenShift Console Versions vs SDK Versions" compatibility table in [Console dynamic plugins README](./README.md). -## 4.21.0-prerelease.x - TBD +## 4.21.0-prerelease.1 - 2025-12-04 -- Deprecated `setPluginStore` function in `k8s-utils.ts`. The function is now a noop and the export +- **Deprecated**: `setPluginStore` function in `k8s-utils.ts`. The function is now a noop and the export will be removed in a future release. ([CONSOLE-4840], [#15671]) -- Fix `popupComponent` prop type in extension `console.dashboards/overview/health/resource` ([CONSOLE-4796], [#15526]) -- Begin alignment of plugin SDK types with `@openshift/dynamic-plugin-sdk` ([CONSOLE-3769], [#15509]) +- **Type breaking**: Fix `popupComponent` prop type in extension `console.dashboards/overview/health/resource` ([CONSOLE-4796], [#15526]) +- **Type breaking**: `AlwaysOnExtension` and `ModelDefinition` types are removed from `api/common-types`. ([CONSOLE-3769], [#15509]) +- The following types are now re-exported from `@openshift/dynamic-plugin-sdk` instead of being defined + locally: `ExtensionFlags`, `ExtensionTypeGuard`, `ResolvedCodeRefProperties`, `RemoteEntryModule`, and `Update`. ([CONSOLE-4840], [#15509], [#15671]) - Add optional `fetch` property to extension `console.dashboards/overview/health/url` ([CONSOLE-4796], [#15526]) - Add optional `infrastructure` parameter to `PrometheusHealthHandler` type ([CONSOLE-4796], [#15526]) - Allow `K8sResourceKind` in `TopologyDataObject`, `TopologyResourcesObject`, and `OverviewItem` types ([CONSOLE-4840], [#15699]) - Allow async functions for the `resources` property of `console.topology/data/factory` extension ([CONSOLE-4806], [#15641]) +- Add color theme and font size customization to `ResourceYAMLEditor` component ([CONSOLE-4701], [#15735]) +- Ensure proper pass-through of `props.editorProps.theme` and `props.options.fontFamily` to `CodeEditor` component ([CONSOLE-4701], [#15735]) ## 4.20.0 - 2025-11-24 @@ -145,6 +149,7 @@ table in [Console dynamic plugins README](./README.md). [CONSOLE-4576]: https://issues.redhat.com/browse/CONSOLE-4576 [CONSOLE-4654]: https://issues.redhat.com/browse/CONSOLE-4654 [CONSOLE-4656]: https://issues.redhat.com/browse/CONSOLE-4656 +[CONSOLE-4701]: https://issues.redhat.com/browse/CONSOLE-4701 [CONSOLE-4796]: https://issues.redhat.com/browse/CONSOLE-4796 [CONSOLE-4806]: https://issues.redhat.com/browse/CONSOLE-4806 [CONSOLE-4840]: https://issues.redhat.com/browse/CONSOLE-4840 @@ -212,3 +217,4 @@ table in [Console dynamic plugins README](./README.md). [#15641]: https://github.com/openshift/console/pull/15641 [#15671]: https://github.com/openshift/console/pull/15671 [#15699]: https://github.com/openshift/console/pull/15699 +[#15735]: https://github.com/openshift/console/pull/15735 diff --git a/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-webpack.md b/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-webpack.md index 6acd1725a7d..cce10d76061 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-webpack.md +++ b/frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-webpack.md @@ -10,6 +10,10 @@ For current development version of Console, use `4.x.0-prerelease.n` packages. For older 1.x plugin SDK packages, refer to "OpenShift Console Versions vs SDK Versions" compatibility table in [Console dynamic plugins README](./README.md). +## 4.21.0-prerelease.1 - 2025-12-04 + +- Remove usage of direct `webpack` imports in favor of `compiler.webpack` ([OCPBUGS-66345], [#15802]) + ## 4.20.0 - 2025-11-24 > Initial release for OCP Console 4.20. @@ -98,6 +102,7 @@ table in [Console dynamic plugins README](./README.md). [OCPBUGS-53030]: https://issues.redhat.com/browse/OCPBUGS-53030 [OCPBUGS-55323]: https://issues.redhat.com/browse/OCPBUGS-55323 [OCPBUGS-61569]: https://issues.redhat.com/browse/OCPBUGS-61569 +[OCPBUGS-66345]: https://issues.redhat.com/browse/OCPBUGS-66345 [#13188]: https://github.com/openshift/console/pull/13188 [#13388]: https://github.com/openshift/console/pull/13388 [#13521]: https://github.com/openshift/console/pull/13521 @@ -115,3 +120,4 @@ table in [Console dynamic plugins README](./README.md). [#14993]: https://github.com/openshift/console/pull/14993 [#15183]: https://github.com/openshift/console/pull/15183 [#15479]: https://github.com/openshift/console/pull/15479 +[#15802]: https://github.com/openshift/console/pull/15802 diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/api/__tests__/api.spec.ts b/frontend/packages/console-dynamic-plugin-sdk/src/api/__tests__/api.spec.ts new file mode 100644 index 00000000000..3b8543b6ca9 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/src/api/__tests__/api.spec.ts @@ -0,0 +1,18 @@ +import * as coreApi from '../core-api'; +import * as internalApi from '../internal-api'; + +describe('@openshift-console/dynamic-plugin-sdk/lib/api/core-api', () => { + Object.entries(coreApi).forEach(([exportName, exportValue]) => { + it(`should export ${exportName}`, () => { + expect(exportValue).toBeDefined(); + }); + }); +}); + +describe('@openshift-console/dynamic-plugin-sdk-internal/lib/api/internal-api', () => { + Object.entries(internalApi).forEach(([exportName, exportValue]) => { + it(`should export ${exportName}`, () => { + expect(exportValue).toBeDefined(); + }); + }); +}); diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-api.ts b/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-api.ts index 3b312a58646..390c83cfe75 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-api.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-api.ts @@ -56,7 +56,7 @@ export const UtilizationItem: React.FC = require('@console .default; export const UtilizationBody: React.FC = require('@console/shared/src/components/dashboard/utilization-card/UtilizationBody') - .default; + .UtilizationBody; export const UtilizationDurationDropdown: React.FC = require('@console/shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown') .UtilizationDurationDropdown; @@ -68,7 +68,7 @@ export const LazyActionMenu: React.FC = require('@console/s .default; export const QuickStartsLoader: React.FC = require('@console/app/src/components/quick-starts/loader/QuickStartsLoader') - .default; + .QuickStartsLoader; export const useUtilizationDuration: UseUtilizationDuration = require('@console/shared/src/hooks/useUtilizationDuration') .useUtilizationDuration; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-topology-api.ts b/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-topology-api.ts index 606b4f26a68..4c49297abd1 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-topology-api.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/api/internal-topology-api.ts @@ -63,8 +63,8 @@ export const getTopologyNodeItem: GetTopologyNodeItem = require('@console/topolo export const mergeGroup: MergeGroup = require('@console/topology/src/data-transforms/transform-utils') .mergeGroup; -export const getModifyApplicationAction: GetModifyApplicationAction = require('@console/topology/src/actions/modify-application') - .getModifyApplicationAction; +export const useGetModifyApplicationAction: GetModifyApplicationAction = require('@console/topology/src/actions/modify-application') + .useGetModifyApplicationAction; export const baseDataModelGetter: BaseDataModelGetter = require('@console/topology/src/data-transforms/data-transformer') .baseDataModelGetter; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts b/frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts index 6aeaa771fb8..7862e7c8b25 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as _ from 'lodash'; -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import { ConsolePluginBuildMetadata } from '../build-types'; import { isEncodedCodeRef, parseEncodedCodeRefValue } from '../coderefs/coderef-resolver'; import { Extension, EncodedCodeRef } from '../types'; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/validation/__tests__/ExtensionValidator.spec.ts b/frontend/packages/console-dynamic-plugin-sdk/src/validation/__tests__/ExtensionValidator.spec.ts index 3eed43575db..095f551e0dc 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/validation/__tests__/ExtensionValidator.spec.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/validation/__tests__/ExtensionValidator.spec.ts @@ -1,4 +1,4 @@ -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import { Extension } from '../../types'; import { collectCodeRefData, findWebpackModules, ExtensionValidator } from '../ExtensionValidator'; import { ValidationResult } from '../ValidationResult'; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts index 1774e853ecb..65134f828c5 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts @@ -10,7 +10,7 @@ import * as glob from 'glob'; import * as _ from 'lodash'; import * as readPkg from 'read-pkg'; import * as semver from 'semver'; -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import { ConsolePluginBuildMetadata, ConsolePluginPackageJSON } from '../build-types'; import { extensionsFile } from '../constants'; import { @@ -437,7 +437,7 @@ export class ConsoleRemotePlugin implements webpack.WebpackPluginInstance { ); if (result.hasErrors()) { - const error = new webpack.WebpackError('ExtensionValidator has reported errors'); + const error = new compiler.webpack.WebpackError('ExtensionValidator has reported errors'); error.details = result.formatErrors(); error.file = extensionsFile; compilation.errors.push(error); @@ -457,7 +457,7 @@ export class ConsoleRemotePlugin implements webpack.WebpackPluginInstance { compiler.hooks.thisCompilation.tap(ConsoleRemotePlugin.name, (compilation) => { const modifiedModules: string[] = []; - webpack.NormalModule.getCompilationHooks(compilation).beforeLoaders.tap( + compiler.webpack.NormalModule.getCompilationHooks(compilation).beforeLoaders.tap( ConsoleRemotePlugin.name, (loaders, normalModule) => { const { userRequest } = normalModule; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ExtensionValidatorPlugin.ts b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ExtensionValidatorPlugin.ts index 55dcfb3b8e2..97c4498a22a 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ExtensionValidatorPlugin.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ExtensionValidatorPlugin.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import { getExtensionsFilePath } from '@console/plugin-sdk/src/codegen/active-plugins'; import { PluginPackage } from '@console/plugin-sdk/src/codegen/plugin-resolver'; import { ConsolePluginPackageJSON } from '../build-types'; @@ -34,7 +34,7 @@ export class ExtensionValidatorPlugin implements webpack.WebpackPluginInstance { ); if (result.hasErrors()) { - const error = new webpack.WebpackError( + const error = new compiler.webpack.WebpackError( `ExtensionValidator has reported errors for plugin ${pkg.name}`, ); error.details = result.formatErrors(); diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/loaders/dynamic-module-import-loader.ts b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/loaders/dynamic-module-import-loader.ts index a13a047514f..87ebf89e954 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/loaders/dynamic-module-import-loader.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/loaders/dynamic-module-import-loader.ts @@ -1,5 +1,5 @@ import * as ts from 'typescript'; -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import { DynamicModuleMap } from '../../utils/dynamic-module-parser'; export type DynamicModuleImportLoaderOptions = { diff --git a/frontend/webpack.circular-deps.ts b/frontend/webpack.circular-deps.ts index c9a552391d3..d1207ed28f6 100644 --- a/frontend/webpack.circular-deps.ts +++ b/frontend/webpack.circular-deps.ts @@ -1,7 +1,7 @@ /* eslint-env node */ /* eslint-disable no-console */ -import * as webpack from 'webpack'; +import type * as webpack from 'webpack'; import * as path from 'path'; import * as fs from 'fs'; import * as CircularDependencyPlugin from 'circular-dependency-plugin'; @@ -14,17 +14,6 @@ type PresetOptions = { exclude?: RegExp; /** Path to write the cycle report to */ reportFile: string; - /** Thresholds for the number of cycles detected before emitting an error */ - thresholds?: Partial<{ - /** - * Maximum number of total cycles permitted. Defaults to 0 - */ - totalCycles: number; - /** - * Maximum number of min-length cycles (A -\> B -\> A) permitted. Defaults to 0 - */ - minLengthCycles: number; - }>; }; type DetectedCycle = { @@ -84,30 +73,6 @@ const getCycleEntries = (cycles: DetectedCycle[]): string => { return cycles.map((c) => `${c.causedBy}\n ${c.modulePaths.join('\n ')}\n`).join('\n'); }; -const applyThresholds = ( - cycles: DetectedCycle[], - thresholds: PresetOptions['thresholds'], - compilation: webpack.Compilation, -) => { - const totalCycles = cycles.length; - if (totalCycles > thresholds.totalCycles) { - compilation.errors.push( - new webpack.WebpackError( - `${HandleCyclesPluginName}: total cycles (${totalCycles}) exceeds threshold (${thresholds.totalCycles})`, - ), - ); - } - - const minLengthCycles = minLengthCycleCount(cycles); - if (minLengthCycles > thresholds.minLengthCycles) { - compilation.errors.push( - new webpack.WebpackError( - `${HandleCyclesPluginName}: min-length cycles (${minLengthCycles}) exceeds threshold (${thresholds.minLengthCycles})`, - ), - ); - } -}; - export class CircularDependencyPreset { constructor(private readonly options: PresetOptions) {} @@ -129,6 +94,7 @@ export class CircularDependencyPreset { return; } + // write report const header = `webpack compilation ${compilation.getStats().hash}\n`; const reportPath = path.resolve(__dirname, this.options.reportFile); @@ -137,16 +103,16 @@ export class CircularDependencyPreset { [header, getCycleStats(cycles), getCycleEntries(cycles)].join('\n'), ); - console.log(chalk.bold.yellow(`Detected ${cycles.length} cycles`)); + console.log(chalk.bold.red(`Detected ${cycles.length} cycles`)); console.log(`Module cycle report written to ${chalk.bold(reportPath)}`); - applyThresholds( - cycles, - { - totalCycles: this.options.thresholds?.totalCycles ?? 0, - minLengthCycles: this.options.thresholds?.minLengthCycles ?? 0, - }, - compilation, + // throw build error + const minLengthCycles = minLengthCycleCount(cycles); + + compilation.errors.push( + new compiler.webpack.WebpackError( + `${HandleCyclesPluginName}: ${cycles.length} total cycles detected, ${minLengthCycles} of which are min-length :-(`, + ), ); }); },