@mouryaamit/nx-polystack 1.14.0 → 1.15.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.
@@ -0,0 +1,67 @@
1
+ import type * as TS from 'typescript';
2
+ import { AngularProject } from './upgrade-standalone';
3
+ /**
4
+ * The `ionic-standalone` step of `pstack upgrade standalone --ionic`: moves an Ionic app that
5
+ * bootstraps with `bootstrapApplication` from Ionic's lazy build (`IonicModule`) to Ionic's
6
+ * standalone components:
7
+ *
8
+ * 1. `importProvidersFrom(IonicModule.forRoot(config))` → `provideIonicAngular(config)` in
9
+ * `main.ts` / `app/app.config.ts`;
10
+ * 2. each standalone component drops `IonicModule` from `imports` and imports the `Ion*` classes
11
+ * of the `ion-*` tags in its template (plus `IonRouterLink` / `IonRouterLinkWithHref` next to
12
+ * `routerLink`);
13
+ * 3. other names imported from Ionic's NgModule entry move to the standalone entry;
14
+ * 4. `<ion-icon name="literal">` names are registered with `addIcons` in the component constructor;
15
+ * 5. the ionicons svg asset leaves the build options when no icon name is left that `addIcons`
16
+ * could not register.
17
+ *
18
+ * All or nothing per app: when one file cannot be converted safely, none of the app's files change
19
+ * and the reasons are reported. An app with no `IonicModule` left is not touched (a rerun changes
20
+ * nothing).
21
+ */
22
+ type Ts = typeof TS;
23
+ export interface IonicContext {
24
+ ts: Ts;
25
+ root: string;
26
+ /** Angular major of the workspace. */
27
+ major: number;
28
+ /** Where the standalone components come from. */
29
+ standaloneEntry: string;
30
+ /** Entries whose imports move to the standalone entry. */
31
+ moving: ReadonlySet<string>;
32
+ /** `Ion*` classes the standalone entry exports. */
33
+ classes: ReadonlySet<string>;
34
+ /** Every name the standalone entry exports, when it is installed. */
35
+ exports?: ReadonlySet<string>;
36
+ /** `ionicons/icons` export names, when installed. */
37
+ icons?: ReadonlySet<string>;
38
+ }
39
+ export interface IonicAppResult {
40
+ /** Absolute path → new text; empty when the app is skipped. */
41
+ writes: Map<string, string>;
42
+ done: string[];
43
+ notes: string[];
44
+ /** Why the app is left as it is (no file changed). */
45
+ reasons: string[];
46
+ }
47
+ /** The context for an Angular major, with the installed Ionic and ionicons exports when present. */
48
+ export declare function ionicContext(ts: Ts, root: string, major: number): IonicContext;
49
+ /** An app whose sources still import IonicModule from @ionic/angular (spec files aside). */
50
+ export declare function isIonicApp(root: string, project: AngularProject): boolean;
51
+ export interface TemplateTag {
52
+ name: string;
53
+ attrs: {
54
+ name: string;
55
+ value?: string;
56
+ }[];
57
+ }
58
+ /** Opening tags of an HTML template with their attributes (quoted values may hold `>`). */
59
+ export declare function scanTags(html: string): TemplateTag[];
60
+ /** Converts one Ionic app (nothing is written here; see IonicAppResult). */
61
+ export declare function convertIonicApp(c: IonicContext, project: AngularProject, libs?: AngularProject[]): IonicAppResult;
62
+ /**
63
+ * The ionic-standalone step on these apps: writes the changes of every app that converts safely,
64
+ * reports the others, and returns the files written (workspace-relative).
65
+ */
66
+ export declare function runIonicStep(root: string, apps: AngularProject[], libs: AngularProject[], angularMajor: number, say: (line: string) => void, log: (line: string) => void): string[];
67
+ export {};