keycloakify 11.8.40 → 11.8.42

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