-
Notifications
You must be signed in to change notification settings - Fork 480
migrate Stencil from v2 to v4 - fix build errors - remove dotcms-field-elements #34076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrate Stencil from v2 to v4 - fix build errors - remove dotcms-field-elements #34076
Conversation
Migrate Stencil from v2.22.2 to v4.39.0 to resolve runtime build errors and fix TypeScript compilation issues introduced after Angular 21 migration. Changes: - Upgrade @stencil/core from ^2.22.2 to ^4.39.0 - Upgrade @stencil/sass from ^2.0.3 to ^3.2.3 - Upgrade @nxext/stencil from 20.1.0 to 21.0.0 - Add type declaration stubs for @angular/common/http and primeng/api - Update TypeScript configs to exclude e2e tests and include type stubs - Fix duplicate outputTargets in dotcms-field-elements stencil.config.ts - Add @babel/runtime dependency and npm overrides for module resolution - Add @types/minimatch for Stencil build compatibility - Fix MCP server module resolution with .js extensions - Fix SCSS @extend issues with !optional flag - Convert type-only imports to 'import type' syntax This resolves the "Cannot read properties of null (reading 'newLine')" error that was preventing Stencil builds from completing, and fixes all TypeScript compilation errors related to missing Angular/PrimeNG type definitions.
|
Semgrep found 1 Risk: Affected versions of @angular/compiler are vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). A stored XSS vulnerability in the Angular Template Compiler arises because its internal security schema doesn't classify certain URL‐ holding attributes (e.g. xlink:href, math|href, annotation|href) or the Manual Review Advice: A vulnerability from this advisory is reachable if you allow Fix: Upgrade this library to at least version 19.2.17 at core/core-web/package-lock.json:28647. Reference(s): GHSA-v4hv-rgfq-gp49, CVE-2025-66412 If this is a critical or high severity finding, please also link this issue in the #security channel in Slack. Semgrep found 1 Risk: http-cache-semantics versions before 4.1.1 are vulnerable to Inefficient Regular Expression Complexity leading to Denial of Service. The issue can be exploited via malicious request header values sent to a server, when that server reads the cache policy from the request using this library. Fix: Upgrade this library to at least version 4.1.1 at core/core-web/package-lock.json:43120. Reference(s): GHSA-rc47-6667-2j5j, CVE-2022-25881 If this is a critical or high severity finding, please also link this issue in the #security channel in Slack. |
Legal RiskThe following dependencies were released under a license that RecommendationWhile merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue. GPL-2.0 MPL-2.0
|
…age-build-and-Stencil-update
Remove the legacy Stencil field elements package and its TS path aliases, and align webcomponents/docs/build so dotcms-ui continues to build successfully.
…ttps://github.com/dotCMS/core into issue-33882-fix-the-image-build-and-Stencil-update
Migrate Stencil from v2 to v4 and Fix Build Errors
Overview
This PR migrates Stencil from version 2.22.2 to 4.39.0 to resolve critical build errors and fixes TypeScript compilation issues that were introduced after the Angular 21 migration.
Problem Statement
After the Angular 21 migration, the Stencil build was failing with:
TypeError: Cannot read properties of null (reading 'newLine')atgetNewLineCharacter- This was a bug in Stencil 2.x that prevented builds from completingCannot find module 'primeng/api'Cannot find module '@angular/common/http'Solution
1. Stencil Migration (v2 → v4)
Upgraded Dependencies:
@stencil/core:^2.22.2→^4.39.0@stencil/sass:^2.0.3→^3.2.3@nxext/stencil:20.1.0→21.0.0Configuration Updates:
outputTargetsindotcms-field-elements/stencil.config.ts@Propcontext/connect usage (none found)Migration References:
2. Type Declaration Stubs
Created type declaration stubs (
stencil-types.d.ts) for both Stencil projects to provide TypeScript type information for external dependencies that aren't available during the Stencil build:@angular/common/http: Stub declarations forHttpClient,HttpRequest,HttpResponse,HttpErrorResponse,HttpEvent,HttpEventType,HttpParams,HttpHeadersprimeng/api: Stub declarations forMenuItem,MenuItemCommandEvent,SelectItemWhy This Approach?
declare moduleFiles Created:
libs/dotcms-webcomponents/stencil-types.d.tslibs/dotcms-field-elements/stencil-types.d.ts3. TypeScript Configuration Updates
Updated
tsconfig.jsonfiles:skipLibCheck: trueto ignore type errors in declaration files**/*.e2e.ts,**/*.e2e.tsx) from buildsincludepaths to reference type declaration filestypes: ["node"]for proper type resolutionFiles Modified:
libs/dotcms-webcomponents/tsconfig.jsonlibs/dotcms-field-elements/tsconfig.json4. Type-Only Imports
Converted regular imports to
import typefor type-only usage to prevent runtime dependencies:Files Modified:
libs/dotcms-models/src/lib/dot-action-menu-item.model.tslibs/dotcms-models/src/lib/dot-apps.model.tslibs/dotcms-models/src/lib/dot-experiments.model.tslibs/dotcms-js/src/lib/core/util/http-response-util.tslibs/dotcms-js/src/lib/core/login.service.ts5. Babel Runtime Module Resolution
Problem: Build was failing with
Module not found: Error: Can't resolve '@babel/runtime/helpers/esm/asyncToGenerator.js'because the build system was looking for@babel/runtimein a nested location.Solution:
@babel/runtime@^7.28.4as a direct dependencyoverridesto ensure proper module hoisting:6. Additional Fixes
MCP Server Module Resolution:
.jsextensions:@modelcontextprotocol/sdk/server/mcp→@modelcontextprotocol/sdk/server/mcp.js@modelcontextprotocol/sdk/shared/protocol→@modelcontextprotocol/sdk/shared/protocol.js@modelcontextprotocol/sdk/types→@modelcontextprotocol/sdk/types.jsSCSS @extend Issues:
!optionalflag to@extend #form-field-disabledin_autocomplete.scss@use "common";at the top ofform/index.scssto ensure proper import orderType Definitions:
@types/minimatch@^5.1.2for Stencil build compatibilityTesting
✅ All builds now succeed:
nx run dotcms-webcomponents:build- ✅ Successnx run dotcms-field-elements:build- ✅ Success (with type stubs)nx run dotcdn:build- ✅ Successnx run mcp-server:build:production- ✅ Successnx run sdk-angular:build:production- ✅ SuccessBreaking Changes
None. This is a bug fix and migration that maintains backward compatibility.
Migration Notes
Related Issues
TypeError: Cannot read properties of null (reading 'newLine')primeng/apiand@angular/common/httpThis PR fixes: #33882
This PR fixes: #33882