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 +89 -70
- package/bin/97.index.js +89 -70
- package/package.json +1 -1
- package/src/bin/update-kc-gen.ts +100 -78
- package/vite-plugin/index.js +89 -70
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
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
`
|
513
|
-
|
514
|
-
`
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
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
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
`
|
1312
|
-
|
1313
|
-
`
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
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
package/src/bin/update-kc-gen.ts
CHANGED
@@ -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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
`
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
`
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
|
package/vite-plugin/index.js
CHANGED
@@ -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
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
`
|
1897
|
-
|
1898
|
-
`
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
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))) {
|