@wavemaker-ai/angular-app 12.0.2-rc.647771 → 12.1.0-rc.647821

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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * ng-circle-progress patching for the UMD (JIT) bundle.
3
+ *
4
+ * ng-circle-progress 1.7.1 is compiled against Angular 14.2.12 and its partial declaration
5
+ * (ɵɵngDeclareComponent) has no `changeDetection` field. The UMD bundle is not run through the
6
+ * Angular linker, so the browser JIT-compiles that declaration — and Angular 22's JIT path
7
+ * (compileComponentDeclaration) defaults a missing `changeDetection` to OnPush regardless of the
8
+ * library's version (the AOT linker only does that for libraries built with Angular >= 22).
9
+ * As OnPush, <circle-progress> never re-renders when its rxjs animation timer assigns `svg`,
10
+ * so it renders as an empty `<circle-progress><!----></circle-progress>`.
11
+ *
12
+ * Fix: pin `changeDetection: Eager` in the declaration, matching the pre-22 behavior.
13
+ */
14
+
15
+ const DECLARATION = /(i0\.ɵɵngDeclareComponent\(\{[^}]*?type: CircleProgressComponent, )/;
16
+
17
+ export function ngCircleProgressPatchPlugin() {
18
+ return {
19
+ name: 'ng-circle-progress-patch',
20
+ transform(code, id) {
21
+ if (!id.includes('ng-circle-progress') || !code.includes('ɵɵngDeclareComponent')) {
22
+ return null;
23
+ }
24
+ if (/type: CircleProgressComponent, [^\n]*changeDetection:/.test(code)) {
25
+ return null;
26
+ }
27
+ if (!DECLARATION.test(code)) {
28
+ throw new Error('[ng-circle-progress-patch] CircleProgressComponent declaration not found — '
29
+ + 'ng-circle-progress output changed, re-check whether the Eager pin is still needed.');
30
+ }
31
+ console.log(' ✅ ng-circle-progress: pinned CircleProgressComponent changeDetection to Eager');
32
+ return {
33
+ code: code.replace(DECLARATION, '$1changeDetection: i0.ChangeDetectionStrategy.Eager, '),
34
+ map: null
35
+ };
36
+ }
37
+ };
38
+ }