keycloakify 11.8.40 → 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 +88 -73
- package/bin/97.index.js +88 -73
- package/package.json +1 -1
- package/src/bin/update-kc-gen.ts +99 -82
- package/vite-plugin/index.js +88 -73
package/bin/786.index.js
CHANGED
@@ -469,80 +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
|
-
|
473
|
-
|
474
|
-
|
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");
|
475
560
|
}
|
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
561
|
const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
|
547
562
|
skip_if_no_changes: {
|
548
563
|
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
|
package/bin/97.index.js
CHANGED
@@ -1268,80 +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
|
-
|
1272
|
-
|
1273
|
-
|
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");
|
1274
1359
|
}
|
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
1360
|
const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
|
1346
1361
|
skip_if_no_changes: {
|
1347
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,89 +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
|
-
|
38
|
-
|
39
|
-
|
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
|
+
].join("\n");
|
54
|
+
|
55
|
+
break set_new_content;
|
56
|
+
}
|
41
57
|
|
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
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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
|
+
}
|
120
137
|
|
121
138
|
const hash = crypto.createHash("sha256").update(newContent).digest("hex");
|
122
139
|
|
package/vite-plugin/index.js
CHANGED
@@ -1853,80 +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
|
-
|
1857
|
-
|
1858
|
-
|
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");
|
1859
1944
|
}
|
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
1945
|
const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
|
1931
1946
|
skip_if_no_changes: {
|
1932
1947
|
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
|