keycloakify 11.8.39 → 11.8.41

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/bin/786.index.js CHANGED
@@ -469,76 +469,95 @@ async function command(params) {
469
469
  const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
470
470
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
471
471
  const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
472
- let newContent = [
473
- ``,
474
- `/* eslint-disable */`,
475
- ``,
476
- `// @ts-nocheck`,
477
- ``,
478
- `// noinspection JSUnusedGlobalSymbols`,
479
- ``,
480
- `import { lazy, Suspense, type ReactNode } from "react";`,
481
- ``,
482
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
483
- ``,
484
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
485
- ``,
486
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
487
- ``,
488
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
489
- ``,
490
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
491
- ``,
492
- `/**`,
493
- ` * NOTE: Do not import this type except maybe in your entrypoint. `,
494
- ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
495
- ` * Depending on the theme type you are working on.`,
496
- ` */`,
497
- `export type KcContext =`,
498
- hasLoginTheme && ` | import("./login/KcContext").KcContext`,
499
- hasAccountTheme && ` | import("./account/KcContext").KcContext`,
500
- hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
501
- ` ;`,
502
- ``,
503
- `declare global {`,
504
- ` interface Window {`,
505
- ` kcContext?: KcContext;`,
506
- ` }`,
507
- `}`,
508
- ``,
509
- hasLoginTheme &&
510
- `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
511
- hasAccountTheme &&
512
- `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
513
- hasAdminTheme &&
514
- `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
515
- ``,
516
- `export function KcPage(`,
517
- ` props: {`,
518
- ` kcContext: KcContext;`,
519
- ` fallback?: ReactNode;`,
520
- ` }`,
521
- `) {`,
522
- ` const { kcContext, fallback } = props;`,
523
- ` return (`,
524
- ` <Suspense fallback={fallback}>`,
525
- ` {(() => {`,
526
- ` switch (kcContext.themeType) {`,
527
- hasLoginTheme &&
528
- ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
529
- hasAccountTheme &&
530
- ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
531
- hasAdminTheme &&
532
- ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
533
- ` }`,
534
- ` })()}`,
535
- ` </Suspense>`,
536
- ` );`,
537
- `}`,
538
- ``
539
- ]
540
- .filter(item => typeof item === "string")
541
- .join("\n");
472
+ let newContent;
473
+ set_new_content: {
474
+ if (!hasLoginTheme && !hasAccountTheme && !hasAdminTheme) {
475
+ newContent = [
476
+ ``,
477
+ `/* eslint-disable */`,
478
+ ``,
479
+ `// @ts-nocheck`,
480
+ ``,
481
+ `// noinspection JSUnusedGlobalSymbols`,
482
+ ``,
483
+ `export function KcPage(_props: { kcContext: any; }){`,
484
+ ` return null;`,
485
+ `}`,
486
+ ``
487
+ ].join("\n");
488
+ break set_new_content;
489
+ }
490
+ newContent = [
491
+ ``,
492
+ `/* eslint-disable */`,
493
+ ``,
494
+ `// @ts-nocheck`,
495
+ ``,
496
+ `// noinspection JSUnusedGlobalSymbols`,
497
+ ``,
498
+ `import { lazy, Suspense, type ReactNode } from "react";`,
499
+ ``,
500
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
501
+ ``,
502
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
503
+ ``,
504
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
505
+ ``,
506
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
507
+ ``,
508
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
509
+ ``,
510
+ `/**`,
511
+ ` * NOTE: Do not import this type except maybe in your entrypoint. `,
512
+ ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
513
+ ` * Depending on the theme type you are working on.`,
514
+ ` */`,
515
+ `export type KcContext =`,
516
+ hasLoginTheme && ` | import("./login/KcContext").KcContext`,
517
+ hasAccountTheme && ` | import("./account/KcContext").KcContext`,
518
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
519
+ ` ;`,
520
+ ``,
521
+ `declare global {`,
522
+ ` interface Window {`,
523
+ ` kcContext?: KcContext;`,
524
+ ` }`,
525
+ `}`,
526
+ ``,
527
+ hasLoginTheme &&
528
+ `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
529
+ hasAccountTheme &&
530
+ `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
531
+ hasAdminTheme &&
532
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
533
+ ``,
534
+ `export function KcPage(`,
535
+ ` props: {`,
536
+ ` kcContext: KcContext;`,
537
+ ` fallback?: ReactNode;`,
538
+ ` }`,
539
+ `) {`,
540
+ ` const { kcContext, fallback } = props;`,
541
+ ` return (`,
542
+ ` <Suspense fallback={fallback}>`,
543
+ ` {(() => {`,
544
+ ` switch (kcContext.themeType) {`,
545
+ hasLoginTheme &&
546
+ ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
547
+ hasAccountTheme &&
548
+ ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
549
+ hasAdminTheme &&
550
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
551
+ ` }`,
552
+ ` })()}`,
553
+ ` </Suspense>`,
554
+ ` );`,
555
+ `}`,
556
+ ``
557
+ ]
558
+ .filter(item => typeof item === "string")
559
+ .join("\n");
560
+ }
542
561
  const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
543
562
  skip_if_no_changes: {
544
563
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
package/bin/97.index.js CHANGED
@@ -1268,76 +1268,95 @@ async function command(params) {
1268
1268
  const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
1269
1269
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
1270
1270
  const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
1271
- let newContent = [
1272
- ``,
1273
- `/* eslint-disable */`,
1274
- ``,
1275
- `// @ts-nocheck`,
1276
- ``,
1277
- `// noinspection JSUnusedGlobalSymbols`,
1278
- ``,
1279
- `import { lazy, Suspense, type ReactNode } from "react";`,
1280
- ``,
1281
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
1282
- ``,
1283
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
1284
- ``,
1285
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
1286
- ``,
1287
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
1288
- ``,
1289
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
1290
- ``,
1291
- `/**`,
1292
- ` * NOTE: Do not import this type except maybe in your entrypoint. `,
1293
- ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
1294
- ` * Depending on the theme type you are working on.`,
1295
- ` */`,
1296
- `export type KcContext =`,
1297
- hasLoginTheme && ` | import("./login/KcContext").KcContext`,
1298
- hasAccountTheme && ` | import("./account/KcContext").KcContext`,
1299
- hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
1300
- ` ;`,
1301
- ``,
1302
- `declare global {`,
1303
- ` interface Window {`,
1304
- ` kcContext?: KcContext;`,
1305
- ` }`,
1306
- `}`,
1307
- ``,
1308
- hasLoginTheme &&
1309
- `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
1310
- hasAccountTheme &&
1311
- `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
1312
- hasAdminTheme &&
1313
- `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
1314
- ``,
1315
- `export function KcPage(`,
1316
- ` props: {`,
1317
- ` kcContext: KcContext;`,
1318
- ` fallback?: ReactNode;`,
1319
- ` }`,
1320
- `) {`,
1321
- ` const { kcContext, fallback } = props;`,
1322
- ` return (`,
1323
- ` <Suspense fallback={fallback}>`,
1324
- ` {(() => {`,
1325
- ` switch (kcContext.themeType) {`,
1326
- hasLoginTheme &&
1327
- ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
1328
- hasAccountTheme &&
1329
- ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
1330
- hasAdminTheme &&
1331
- ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
1332
- ` }`,
1333
- ` })()}`,
1334
- ` </Suspense>`,
1335
- ` );`,
1336
- `}`,
1337
- ``
1338
- ]
1339
- .filter(item => typeof item === "string")
1340
- .join("\n");
1271
+ let newContent;
1272
+ set_new_content: {
1273
+ if (!hasLoginTheme && !hasAccountTheme && !hasAdminTheme) {
1274
+ newContent = [
1275
+ ``,
1276
+ `/* eslint-disable */`,
1277
+ ``,
1278
+ `// @ts-nocheck`,
1279
+ ``,
1280
+ `// noinspection JSUnusedGlobalSymbols`,
1281
+ ``,
1282
+ `export function KcPage(_props: { kcContext: any; }){`,
1283
+ ` return null;`,
1284
+ `}`,
1285
+ ``
1286
+ ].join("\n");
1287
+ break set_new_content;
1288
+ }
1289
+ newContent = [
1290
+ ``,
1291
+ `/* eslint-disable */`,
1292
+ ``,
1293
+ `// @ts-nocheck`,
1294
+ ``,
1295
+ `// noinspection JSUnusedGlobalSymbols`,
1296
+ ``,
1297
+ `import { lazy, Suspense, type ReactNode } from "react";`,
1298
+ ``,
1299
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
1300
+ ``,
1301
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
1302
+ ``,
1303
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
1304
+ ``,
1305
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
1306
+ ``,
1307
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
1308
+ ``,
1309
+ `/**`,
1310
+ ` * NOTE: Do not import this type except maybe in your entrypoint. `,
1311
+ ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
1312
+ ` * Depending on the theme type you are working on.`,
1313
+ ` */`,
1314
+ `export type KcContext =`,
1315
+ hasLoginTheme && ` | import("./login/KcContext").KcContext`,
1316
+ hasAccountTheme && ` | import("./account/KcContext").KcContext`,
1317
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
1318
+ ` ;`,
1319
+ ``,
1320
+ `declare global {`,
1321
+ ` interface Window {`,
1322
+ ` kcContext?: KcContext;`,
1323
+ ` }`,
1324
+ `}`,
1325
+ ``,
1326
+ hasLoginTheme &&
1327
+ `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
1328
+ hasAccountTheme &&
1329
+ `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
1330
+ hasAdminTheme &&
1331
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
1332
+ ``,
1333
+ `export function KcPage(`,
1334
+ ` props: {`,
1335
+ ` kcContext: KcContext;`,
1336
+ ` fallback?: ReactNode;`,
1337
+ ` }`,
1338
+ `) {`,
1339
+ ` const { kcContext, fallback } = props;`,
1340
+ ` return (`,
1341
+ ` <Suspense fallback={fallback}>`,
1342
+ ` {(() => {`,
1343
+ ` switch (kcContext.themeType) {`,
1344
+ hasLoginTheme &&
1345
+ ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
1346
+ hasAccountTheme &&
1347
+ ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
1348
+ hasAdminTheme &&
1349
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
1350
+ ` }`,
1351
+ ` })()}`,
1352
+ ` </Suspense>`,
1353
+ ` );`,
1354
+ `}`,
1355
+ ``
1356
+ ]
1357
+ .filter(item => typeof item === "string")
1358
+ .join("\n");
1359
+ }
1341
1360
  const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
1342
1361
  skip_if_no_changes: {
1343
1362
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.8.39",
3
+ "version": "11.8.41",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,84 +34,106 @@ export async function command(params: { buildContext: BuildContext }) {
34
34
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
35
35
  const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
36
36
 
37
- let newContent = [
38
- ``,
39
- `/* eslint-disable */`,
40
- ``,
41
- `// @ts-nocheck`,
42
- ``,
43
- `// noinspection JSUnusedGlobalSymbols`,
44
- ``,
45
- `import { lazy, Suspense, type ReactNode } from "react";`,
46
- ``,
47
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
48
- ``,
49
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
50
- ``,
51
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
52
- ``,
53
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
54
- ``,
55
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(
56
- Object.fromEntries(
57
- buildContext.environmentVariables.map(
58
- ({ name, default: defaultValue }) => [name, defaultValue]
59
- )
60
- ),
61
- null,
62
- 2
63
- )};`,
64
- ``,
65
- `/**`,
66
- ` * NOTE: Do not import this type except maybe in your entrypoint. `,
67
- ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
68
- ` * Depending on the theme type you are working on.`,
69
- ` */`,
70
- `export type KcContext =`,
71
- hasLoginTheme && ` | import("./login/KcContext").KcContext`,
72
- hasAccountTheme && ` | import("./account/KcContext").KcContext`,
73
- hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
74
- ` ;`,
75
- ``,
76
- `declare global {`,
77
- ` interface Window {`,
78
- ` kcContext?: KcContext;`,
79
- ` }`,
80
- `}`,
81
- ``,
82
- hasLoginTheme &&
83
- `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
84
- hasAccountTheme &&
85
- `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
86
- hasAdminTheme &&
87
- `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
88
- ``,
89
- `export function KcPage(`,
90
- ` props: {`,
91
- ` kcContext: KcContext;`,
92
- ` fallback?: ReactNode;`,
93
- ` }`,
94
- `) {`,
95
- ` const { kcContext, fallback } = props;`,
96
- ` return (`,
97
- ` <Suspense fallback={fallback}>`,
98
- ` {(() => {`,
99
- ` switch (kcContext.themeType) {`,
100
- hasLoginTheme &&
101
- ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
102
- hasAccountTheme &&
103
- ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
104
- hasAdminTheme &&
105
- ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
106
- ` }`,
107
- ` })()}`,
108
- ` </Suspense>`,
109
- ` );`,
110
- `}`,
111
- ``
112
- ]
113
- .filter(item => typeof item === "string")
114
- .join("\n");
37
+ let newContent: string;
38
+
39
+ set_new_content: {
40
+ if (!hasLoginTheme && !hasAccountTheme && !hasAdminTheme) {
41
+ newContent = [
42
+ ``,
43
+ `/* eslint-disable */`,
44
+ ``,
45
+ `// @ts-nocheck`,
46
+ ``,
47
+ `// noinspection JSUnusedGlobalSymbols`,
48
+ ``,
49
+ `export function KcPage(_props: { kcContext: any; }){`,
50
+ ` return null;`,
51
+ `}`,
52
+ ``
53
+ ].join("\n");
54
+
55
+ break set_new_content;
56
+ }
57
+
58
+ newContent = [
59
+ ``,
60
+ `/* eslint-disable */`,
61
+ ``,
62
+ `// @ts-nocheck`,
63
+ ``,
64
+ `// noinspection JSUnusedGlobalSymbols`,
65
+ ``,
66
+ `import { lazy, Suspense, type ReactNode } from "react";`,
67
+ ``,
68
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
69
+ ``,
70
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
71
+ ``,
72
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
73
+ ``,
74
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
75
+ ``,
76
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(
77
+ Object.fromEntries(
78
+ buildContext.environmentVariables.map(
79
+ ({ name, default: defaultValue }) => [name, defaultValue]
80
+ )
81
+ ),
82
+ null,
83
+ 2
84
+ )};`,
85
+ ``,
86
+ `/**`,
87
+ ` * NOTE: Do not import this type except maybe in your entrypoint. `,
88
+ ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
89
+ ` * Depending on the theme type you are working on.`,
90
+ ` */`,
91
+ `export type KcContext =`,
92
+ hasLoginTheme && ` | import("./login/KcContext").KcContext`,
93
+ hasAccountTheme && ` | import("./account/KcContext").KcContext`,
94
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
95
+ ` ;`,
96
+ ``,
97
+ `declare global {`,
98
+ ` interface Window {`,
99
+ ` kcContext?: KcContext;`,
100
+ ` }`,
101
+ `}`,
102
+ ``,
103
+ hasLoginTheme &&
104
+ `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
105
+ hasAccountTheme &&
106
+ `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
107
+ hasAdminTheme &&
108
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
109
+ ``,
110
+ `export function KcPage(`,
111
+ ` props: {`,
112
+ ` kcContext: KcContext;`,
113
+ ` fallback?: ReactNode;`,
114
+ ` }`,
115
+ `) {`,
116
+ ` const { kcContext, fallback } = props;`,
117
+ ` return (`,
118
+ ` <Suspense fallback={fallback}>`,
119
+ ` {(() => {`,
120
+ ` switch (kcContext.themeType) {`,
121
+ hasLoginTheme &&
122
+ ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
123
+ hasAccountTheme &&
124
+ ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
125
+ hasAdminTheme &&
126
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
127
+ ` }`,
128
+ ` })()}`,
129
+ ` </Suspense>`,
130
+ ` );`,
131
+ `}`,
132
+ ``
133
+ ]
134
+ .filter(item => typeof item === "string")
135
+ .join("\n");
136
+ }
115
137
 
116
138
  const hash = crypto.createHash("sha256").update(newContent).digest("hex");
117
139
 
@@ -1853,76 +1853,95 @@ async function command(params) {
1853
1853
  const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
1854
1854
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
1855
1855
  const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
1856
- let newContent = [
1857
- ``,
1858
- `/* eslint-disable */`,
1859
- ``,
1860
- `// @ts-nocheck`,
1861
- ``,
1862
- `// noinspection JSUnusedGlobalSymbols`,
1863
- ``,
1864
- `import { lazy, Suspense, type ReactNode } from "react";`,
1865
- ``,
1866
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
1867
- ``,
1868
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
1869
- ``,
1870
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
1871
- ``,
1872
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
1873
- ``,
1874
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
1875
- ``,
1876
- `/**`,
1877
- ` * NOTE: Do not import this type except maybe in your entrypoint. `,
1878
- ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
1879
- ` * Depending on the theme type you are working on.`,
1880
- ` */`,
1881
- `export type KcContext =`,
1882
- hasLoginTheme && ` | import("./login/KcContext").KcContext`,
1883
- hasAccountTheme && ` | import("./account/KcContext").KcContext`,
1884
- hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
1885
- ` ;`,
1886
- ``,
1887
- `declare global {`,
1888
- ` interface Window {`,
1889
- ` kcContext?: KcContext;`,
1890
- ` }`,
1891
- `}`,
1892
- ``,
1893
- hasLoginTheme &&
1894
- `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
1895
- hasAccountTheme &&
1896
- `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
1897
- hasAdminTheme &&
1898
- `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
1899
- ``,
1900
- `export function KcPage(`,
1901
- ` props: {`,
1902
- ` kcContext: KcContext;`,
1903
- ` fallback?: ReactNode;`,
1904
- ` }`,
1905
- `) {`,
1906
- ` const { kcContext, fallback } = props;`,
1907
- ` return (`,
1908
- ` <Suspense fallback={fallback}>`,
1909
- ` {(() => {`,
1910
- ` switch (kcContext.themeType) {`,
1911
- hasLoginTheme &&
1912
- ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
1913
- hasAccountTheme &&
1914
- ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
1915
- hasAdminTheme &&
1916
- ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
1917
- ` }`,
1918
- ` })()}`,
1919
- ` </Suspense>`,
1920
- ` );`,
1921
- `}`,
1922
- ``
1923
- ]
1924
- .filter(item => typeof item === "string")
1925
- .join("\n");
1856
+ let newContent;
1857
+ set_new_content: {
1858
+ if (!hasLoginTheme && !hasAccountTheme && !hasAdminTheme) {
1859
+ newContent = [
1860
+ ``,
1861
+ `/* eslint-disable */`,
1862
+ ``,
1863
+ `// @ts-nocheck`,
1864
+ ``,
1865
+ `// noinspection JSUnusedGlobalSymbols`,
1866
+ ``,
1867
+ `export function KcPage(_props: { kcContext: any; }){`,
1868
+ ` return null;`,
1869
+ `}`,
1870
+ ``
1871
+ ].join("\n");
1872
+ break set_new_content;
1873
+ }
1874
+ newContent = [
1875
+ ``,
1876
+ `/* eslint-disable */`,
1877
+ ``,
1878
+ `// @ts-nocheck`,
1879
+ ``,
1880
+ `// noinspection JSUnusedGlobalSymbols`,
1881
+ ``,
1882
+ `import { lazy, Suspense, type ReactNode } from "react";`,
1883
+ ``,
1884
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
1885
+ ``,
1886
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
1887
+ ``,
1888
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
1889
+ ``,
1890
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
1891
+ ``,
1892
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
1893
+ ``,
1894
+ `/**`,
1895
+ ` * NOTE: Do not import this type except maybe in your entrypoint. `,
1896
+ ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
1897
+ ` * Depending on the theme type you are working on.`,
1898
+ ` */`,
1899
+ `export type KcContext =`,
1900
+ hasLoginTheme && ` | import("./login/KcContext").KcContext`,
1901
+ hasAccountTheme && ` | import("./account/KcContext").KcContext`,
1902
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
1903
+ ` ;`,
1904
+ ``,
1905
+ `declare global {`,
1906
+ ` interface Window {`,
1907
+ ` kcContext?: KcContext;`,
1908
+ ` }`,
1909
+ `}`,
1910
+ ``,
1911
+ hasLoginTheme &&
1912
+ `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
1913
+ hasAccountTheme &&
1914
+ `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
1915
+ hasAdminTheme &&
1916
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
1917
+ ``,
1918
+ `export function KcPage(`,
1919
+ ` props: {`,
1920
+ ` kcContext: KcContext;`,
1921
+ ` fallback?: ReactNode;`,
1922
+ ` }`,
1923
+ `) {`,
1924
+ ` const { kcContext, fallback } = props;`,
1925
+ ` return (`,
1926
+ ` <Suspense fallback={fallback}>`,
1927
+ ` {(() => {`,
1928
+ ` switch (kcContext.themeType) {`,
1929
+ hasLoginTheme &&
1930
+ ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
1931
+ hasAccountTheme &&
1932
+ ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
1933
+ hasAdminTheme &&
1934
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
1935
+ ` }`,
1936
+ ` })()}`,
1937
+ ` </Suspense>`,
1938
+ ` );`,
1939
+ `}`,
1940
+ ``
1941
+ ]
1942
+ .filter(item => typeof item === "string")
1943
+ .join("\n");
1944
+ }
1926
1945
  const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
1927
1946
  skip_if_no_changes: {
1928
1947
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {