keycloakify 11.7.4 → 11.8.1

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.
Files changed (38) hide show
  1. package/bin/{33.index.js → 226.index.js} +2 -19
  2. package/bin/{911.index.js → 297.index.js} +18918 -11359
  3. package/bin/355.index.js +41 -703
  4. package/bin/363.index.js +115 -93
  5. package/bin/369.index.js +968 -0
  6. package/bin/{288.index.js → 502.index.js} +123 -227
  7. package/bin/656.index.js +111 -0
  8. package/bin/{880.index.js → 712.index.js} +227 -216
  9. package/bin/780.index.js +9 -7
  10. package/bin/932.index.js +965 -0
  11. package/bin/97.index.js +2099 -769
  12. package/bin/main.js +66 -49
  13. package/bin/shared/buildContext.d.ts +11 -3
  14. package/bin/start-keycloak/realmConfig/prepareRealmConfig.d.ts +5 -6
  15. package/bin/start-keycloak/realmConfig/realmConfig.d.ts +6 -2
  16. package/package.json +12 -17
  17. package/src/bin/initialize-account-theme/initialize-account-theme.ts +29 -27
  18. package/src/bin/initialize-email-theme.ts +103 -53
  19. package/src/bin/keycloakify/buildJars/buildJar.ts +45 -20
  20. package/src/bin/keycloakify/generateResources/generateResources.ts +263 -217
  21. package/src/bin/shared/{initializeSpa/addSyncExtensionsToPostinstallScript.ts → addSyncExtensionsToPostinstallScript.ts} +1 -1
  22. package/src/bin/shared/buildContext.ts +69 -24
  23. package/src/bin/shared/{initializeSpa/initializeSpa.ts → initializeSpa.ts} +3 -3
  24. package/src/bin/start-keycloak/realmConfig/prepareRealmConfig.ts +12 -23
  25. package/src/bin/start-keycloak/realmConfig/realmConfig.ts +14 -12
  26. package/src/bin/start-keycloak/start-keycloak.ts +55 -28
  27. package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +6 -0
  28. package/vite-plugin/index.js +48 -20
  29. package/bin/313.index.js +0 -377
  30. package/bin/678.index.js +0 -7565
  31. package/bin/9.index.js +0 -850
  32. package/bin/947.index.js +0 -1565
  33. package/bin/shared/initializeSpa/index.d.ts +0 -1
  34. package/bin/shared/metaInfKeycloakThemes.d.ts +0 -13
  35. package/src/bin/shared/initializeSpa/index.ts +0 -1
  36. package/src/bin/shared/metaInfKeycloakThemes.ts +0 -40
  37. /package/bin/shared/{initializeSpa/addSyncExtensionsToPostinstallScript.d.ts → addSyncExtensionsToPostinstallScript.d.ts} +0 -0
  38. /package/bin/shared/{initializeSpa/initializeSpa.d.ts → initializeSpa.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.id = 880;
3
- exports.ids = [880];
2
+ exports.id = 712;
3
+ exports.ids = [712];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 73817:
@@ -314,7 +314,7 @@ function recastParseTs(filePath) {
314
314
 
315
315
  /***/ }),
316
316
 
317
- /***/ 59880:
317
+ /***/ 35712:
318
318
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
319
319
 
320
320
  // ESM COMPAT FLAG
@@ -757,29 +757,6 @@ function readExtraPagesNames(params) {
757
757
  var generateMessageProperties = __webpack_require__(73817);
758
758
  // EXTERNAL MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
759
759
  var readThisNpmPackageVersion = __webpack_require__(64795);
760
- ;// CONCATENATED MODULE: ./dist/bin/shared/metaInfKeycloakThemes.js
761
-
762
-
763
- function writeMetaInfKeycloakThemes(params) {
764
- const { resourcesDirPath, getNewMetaInfKeycloakTheme } = params;
765
- const filePath = (0,external_path_.join)(resourcesDirPath, "META-INF", "keycloak-themes.json");
766
- const currentMetaInfKeycloakTheme = !external_fs_.existsSync(filePath)
767
- ? undefined
768
- : JSON.parse(external_fs_.readFileSync(filePath).toString("utf8"));
769
- const newMetaInfKeycloakThemes = getNewMetaInfKeycloakTheme({
770
- metaInfKeycloakTheme: currentMetaInfKeycloakTheme
771
- });
772
- {
773
- const dirPath = (0,external_path_.dirname)(filePath);
774
- if (!external_fs_.existsSync(dirPath)) {
775
- external_fs_.mkdirSync(dirPath, { recursive: true });
776
- }
777
- }
778
- external_fs_.writeFileSync(filePath, Buffer.from(JSON.stringify(newMetaInfKeycloakThemes, null, 2), "utf8"));
779
- }
780
- //# sourceMappingURL=metaInfKeycloakThemes.js.map
781
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/objectEntries.mjs
782
- var objectEntries = __webpack_require__(91040);
783
760
  // EXTERNAL MODULE: ./dist/bin/tools/escapeStringForPropertiesFile.js
784
761
  var escapeStringForPropertiesFile = __webpack_require__(27190);
785
762
  // EXTERNAL MODULE: ./node_modules/properties-parser/index.js
@@ -847,6 +824,8 @@ function createObjectWithSomePropertiesThatThrowIfAccessed(obj, debugMessage) {
847
824
  //# sourceMappingURL=createObjectThatThrowsIfAccessed.js.map
848
825
  // EXTERNAL MODULE: ./dist/bin/tools/listInstalledModules.js
849
826
  var listInstalledModules = __webpack_require__(75564);
827
+ // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
828
+ var isInside = __webpack_require__(90665);
850
829
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateResources/generateResources.js
851
830
 
852
831
 
@@ -867,7 +846,6 @@ var listInstalledModules = __webpack_require__(75564);
867
846
 
868
847
 
869
848
 
870
-
871
849
  (0,assert/* assert */.h)();
872
850
  async function generateResources(params) {
873
851
  var _a;
@@ -881,9 +859,14 @@ async function generateResources(params) {
881
859
  return (0,external_path_.join)(resourcesDirPath, "theme", themeName, themeType);
882
860
  };
883
861
  const writeMessagePropertiesFilesByThemeType = {};
884
- for (const themeType of constants/* THEME_TYPES */.Jh) {
885
- if (!buildContext.implementedThemeTypes[themeType].isImplemented) {
886
- continue;
862
+ for (const themeType of [...constants/* THEME_TYPES */.Jh, "email"]) {
863
+ let isNative;
864
+ {
865
+ const v = buildContext.implementedThemeTypes[themeType];
866
+ if (!v.isImplemented && !v.isImplemented_native) {
867
+ continue;
868
+ }
869
+ isNative = !v.isImplemented && v.isImplemented_native;
887
870
  }
888
871
  const getAccountThemeType = () => {
889
872
  (0,assert/* assert */.h)(themeType === "account");
@@ -898,10 +881,15 @@ async function generateResources(params) {
898
881
  return getAccountThemeType() === "Single-Page";
899
882
  case "admin":
900
883
  return true;
884
+ case "email":
885
+ return false;
901
886
  }
902
887
  })();
903
888
  const themeTypeDirPath = getThemeTypeDirPath({ themeName, themeType });
904
889
  apply_replacers_and_move_to_theme_resources: {
890
+ if (isNative) {
891
+ break apply_replacers_and_move_to_theme_resources;
892
+ }
905
893
  const destDirPath = (0,external_path_.join)(themeTypeDirPath, "resources", constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.DIST */.Ju.DIST);
906
894
  // NOTE: Prevent accumulation of files in the assets dir, as names are hashed they pile up.
907
895
  (0,fs_rmSync/* rmSync */.a)(destDirPath, { recursive: true, force: true });
@@ -957,50 +945,75 @@ async function generateResources(params) {
957
945
  }
958
946
  });
959
947
  }
960
- const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
961
- themeName,
962
- indexHtmlCode: external_fs_default().readFileSync((0,external_path_.join)(buildContext.projectBuildDirPath, "index.html"))
963
- .toString("utf8"),
964
- buildContext,
965
- keycloakifyVersion: (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)(),
966
- themeType,
967
- fieldNames: isSpa
968
- ? []
969
- : ((0,assert/* assert */.h)(themeType !== "admin"),
970
- readFieldNameUsage({
971
- themeSrcDirPath: buildContext.themeSrcDirPath,
972
- themeType
948
+ generate_ftl_files: {
949
+ if (isNative) {
950
+ break generate_ftl_files;
951
+ }
952
+ (0,assert/* assert */.h)(themeType !== "email");
953
+ const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
954
+ themeName,
955
+ indexHtmlCode: external_fs_default().readFileSync((0,external_path_.join)(buildContext.projectBuildDirPath, "index.html"))
956
+ .toString("utf8"),
957
+ buildContext,
958
+ keycloakifyVersion: (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)(),
959
+ themeType,
960
+ fieldNames: isSpa
961
+ ? []
962
+ : ((0,assert/* assert */.h)(themeType !== "admin"),
963
+ readFieldNameUsage({
964
+ themeSrcDirPath: buildContext.themeSrcDirPath,
965
+ themeType
966
+ }))
967
+ });
968
+ [
969
+ ...(() => {
970
+ switch (themeType) {
971
+ case "login":
972
+ return constants/* LOGIN_THEME_PAGE_IDS */.XV;
973
+ case "account":
974
+ return getAccountThemeType() === "Single-Page"
975
+ ? ["index.ftl"]
976
+ : constants/* ACCOUNT_THEME_PAGE_IDS */.yV;
977
+ case "admin":
978
+ return ["index.ftl"];
979
+ }
980
+ })(),
981
+ ...(isSpa
982
+ ? []
983
+ : readExtraPagesNames({
984
+ themeType,
985
+ themeSrcDirPath: buildContext.themeSrcDirPath
973
986
  }))
974
- });
975
- [
976
- ...(() => {
977
- switch (themeType) {
978
- case "login":
979
- return constants/* LOGIN_THEME_PAGE_IDS */.XV;
980
- case "account":
981
- return getAccountThemeType() === "Single-Page"
982
- ? ["index.ftl"]
983
- : constants/* ACCOUNT_THEME_PAGE_IDS */.yV;
984
- case "admin":
985
- return ["index.ftl"];
987
+ ].forEach(pageId => {
988
+ const { ftlCode } = generateFtlFilesCode({ pageId });
989
+ external_fs_default().writeFileSync((0,external_path_.join)(themeTypeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
990
+ });
991
+ }
992
+ copy_native_theme: {
993
+ if (!isNative) {
994
+ break copy_native_theme;
995
+ }
996
+ const dirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType);
997
+ (0,transformCodebase/* transformCodebase */.N)({
998
+ srcDirPath: dirPath,
999
+ destDirPath: getThemeTypeDirPath({ themeName, themeType }),
1000
+ transformSourceCode: ({ fileRelativePath, sourceCode }) => {
1001
+ if ((0,isInside/* isInside */.V)({ dirPath: "messages", filePath: fileRelativePath })) {
1002
+ return undefined;
1003
+ }
1004
+ return { modifiedSourceCode: sourceCode };
986
1005
  }
987
- })(),
988
- ...(isSpa
989
- ? []
990
- : readExtraPagesNames({
991
- themeType,
992
- themeSrcDirPath: buildContext.themeSrcDirPath
993
- }))
994
- ].forEach(pageId => {
995
- const { ftlCode } = generateFtlFilesCode({ pageId });
996
- external_fs_default().writeFileSync((0,external_path_.join)(themeTypeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
997
- });
1006
+ });
1007
+ }
998
1008
  let languageTags = undefined;
999
1009
  i18n_multi_page: {
1010
+ if (isNative) {
1011
+ break i18n_multi_page;
1012
+ }
1000
1013
  if (isSpa) {
1001
1014
  break i18n_multi_page;
1002
1015
  }
1003
- (0,assert/* assert */.h)(themeType !== "admin");
1016
+ (0,assert/* assert */.h)(themeType !== "admin" && themeType !== "email");
1004
1017
  const wrap = (0,generateMessageProperties/* generateMessageProperties */.k)({
1005
1018
  buildContext,
1006
1019
  themeType
@@ -1070,16 +1083,17 @@ async function generateResources(params) {
1070
1083
  languageTags = external_fs_default().readdirSync(messagesDirPath_dest)
1071
1084
  .map(basename => basename.replace(/^messages_/, "").replace(/\.properties$/, ""));
1072
1085
  }
1073
- i18n_single_page: {
1074
- if (!isSpa) {
1075
- break i18n_single_page;
1086
+ i18n_for_spas_and_native: {
1087
+ if (!isSpa && !isNative) {
1088
+ break i18n_for_spas_and_native;
1076
1089
  }
1077
1090
  if (isLegacyAccountSpa) {
1078
- break i18n_single_page;
1091
+ break i18n_for_spas_and_native;
1092
+ }
1093
+ const messagesDirPath_theme = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, isNative ? "messages" : "i18n");
1094
+ if (!external_fs_default().existsSync(messagesDirPath_theme)) {
1095
+ break i18n_for_spas_and_native;
1079
1096
  }
1080
- (0,assert/* assert */.h)(themeType === "account" || themeType === "admin");
1081
- const messagesDirPath_theme = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, "i18n");
1082
- (0,assert/* assert */.h)(external_fs_default().existsSync(messagesDirPath_theme), `${messagesDirPath_theme} is supposed to exist`);
1083
1097
  const propertiesByLang = {};
1084
1098
  external_fs_default().readdirSync(messagesDirPath_theme).forEach(basename => {
1085
1099
  var _a;
@@ -1158,6 +1172,9 @@ async function generateResources(params) {
1158
1172
  };
1159
1173
  }
1160
1174
  keycloak_static_resources: {
1175
+ if (isNative) {
1176
+ break keycloak_static_resources;
1177
+ }
1161
1178
  if (isSpa) {
1162
1179
  break keycloak_static_resources;
1163
1180
  }
@@ -1166,138 +1183,130 @@ async function generateResources(params) {
1166
1183
  destDirPath: (0,external_path_.join)(themeTypeDirPath, "resources")
1167
1184
  });
1168
1185
  }
1169
- external_fs_default().writeFileSync((0,external_path_.join)(themeTypeDirPath, "theme.properties"), Buffer.from([
1170
- `parent=${(() => {
1171
- switch (themeType) {
1172
- case "account":
1173
- switch (getAccountThemeType()) {
1174
- case "Multi-Page":
1175
- return "account-v1";
1176
- case "Single-Page":
1177
- return "base";
1178
- }
1179
- case "login":
1180
- return "keycloak";
1181
- case "admin":
1182
- return "base";
1183
- }
1184
- (0,assert/* assert */.h)(false);
1185
- })()}`,
1186
- ...(themeType === "account" && getAccountThemeType() === "Single-Page"
1187
- ? ["deprecatedMode=false"]
1188
- : []),
1189
- ...((_a = buildContext.extraThemeProperties) !== null && _a !== void 0 ? _a : []),
1190
- ...[
1191
- ...buildContext.environmentVariables,
1192
- { name: constants/* KEYCLOAKIFY_SPA_DEV_SERVER_PORT */.Sz, default: "" }
1193
- ].map(({ name, default: defaultValue }) => `${name}=\${env.${name}:${(0,escapeStringForPropertiesFile/* escapeStringForPropertiesFile */.y)(defaultValue)}}`),
1194
- ...(languageTags === undefined
1195
- ? []
1196
- : [`locales=${languageTags.join(",")}`])
1197
- ].join("\n\n"), "utf8"));
1198
- }
1199
- email: {
1200
- if (!buildContext.implementedThemeTypes.email.isImplemented) {
1201
- break email;
1202
- }
1203
- const emailThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "email");
1204
- (0,transformCodebase/* transformCodebase */.N)({
1205
- srcDirPath: emailThemeSrcDirPath,
1206
- destDirPath: getThemeTypeDirPath({ themeName, themeType: "email" })
1207
- });
1208
- }
1209
- bring_in_account_v1: {
1210
- if (!buildContext.implementedThemeTypes.account.isImplemented) {
1211
- break bring_in_account_v1;
1212
- }
1213
- if (buildContext.implementedThemeTypes.account.type !== "Multi-Page") {
1214
- break bring_in_account_v1;
1215
- }
1216
- (0,transformCodebase/* transformCodebase */.N)({
1217
- srcDirPath: (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "res", "account-v1"),
1218
- destDirPath: getThemeTypeDirPath({
1219
- themeName: "account-v1",
1220
- themeType: "account"
1221
- })
1222
- });
1223
- }
1224
- {
1225
- const metaInfKeycloakThemes = { themes: [] };
1226
- for (const themeName of buildContext.themeNames) {
1227
- metaInfKeycloakThemes.themes.push({
1228
- name: themeName,
1229
- types: (0,objectEntries/* objectEntries */.q)(buildContext.implementedThemeTypes)
1230
- .filter(([, { isImplemented }]) => isImplemented)
1231
- .map(([themeType]) => themeType)
1186
+ bring_in_account_v1: {
1187
+ if (isNative) {
1188
+ break bring_in_account_v1;
1189
+ }
1190
+ if (themeType !== "account") {
1191
+ break bring_in_account_v1;
1192
+ }
1193
+ (0,assert/* assert */.h)(buildContext.implementedThemeTypes.account.isImplemented);
1194
+ if (buildContext.implementedThemeTypes.account.type !== "Multi-Page") {
1195
+ break bring_in_account_v1;
1196
+ }
1197
+ (0,transformCodebase/* transformCodebase */.N)({
1198
+ srcDirPath: (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "res", "account-v1"),
1199
+ destDirPath: getThemeTypeDirPath({
1200
+ themeName: "account-v1",
1201
+ themeType: "account"
1202
+ })
1232
1203
  });
1233
1204
  }
1234
- if (buildContext.implementedThemeTypes.account.isImplemented) {
1235
- metaInfKeycloakThemes.themes.push({
1236
- name: "account-v1",
1237
- types: ["account"]
1238
- });
1205
+ generate_theme_properties: {
1206
+ if (isNative) {
1207
+ break generate_theme_properties;
1208
+ }
1209
+ (0,assert/* assert */.h)(themeType !== "email");
1210
+ external_fs_default().writeFileSync((0,external_path_.join)(themeTypeDirPath, "theme.properties"), Buffer.from([
1211
+ `parent=${(() => {
1212
+ switch (themeType) {
1213
+ case "account":
1214
+ switch (getAccountThemeType()) {
1215
+ case "Multi-Page":
1216
+ return "account-v1";
1217
+ case "Single-Page":
1218
+ return "base";
1219
+ }
1220
+ case "login":
1221
+ return "keycloak";
1222
+ case "admin":
1223
+ return "base";
1224
+ }
1225
+ assert/* assert */.h;
1226
+ })()}`,
1227
+ ...(themeType === "account" &&
1228
+ getAccountThemeType() === "Single-Page"
1229
+ ? ["deprecatedMode=false"]
1230
+ : []),
1231
+ ...((_a = buildContext.extraThemeProperties) !== null && _a !== void 0 ? _a : []),
1232
+ ...[
1233
+ ...buildContext.environmentVariables,
1234
+ { name: constants/* KEYCLOAKIFY_SPA_DEV_SERVER_PORT */.Sz, default: "" }
1235
+ ].map(({ name, default: defaultValue }) => `${name}=\${env.${name}:${(0,escapeStringForPropertiesFile/* escapeStringForPropertiesFile */.y)(defaultValue)}}`),
1236
+ ...(languageTags === undefined
1237
+ ? []
1238
+ : [`locales=${languageTags.join(",")}`])
1239
+ ].join("\n\n"), "utf8"));
1239
1240
  }
1240
- writeMetaInfKeycloakThemes({
1241
- resourcesDirPath,
1242
- getNewMetaInfKeycloakTheme: () => metaInfKeycloakThemes
1243
- });
1244
1241
  }
1245
1242
  for (const themeVariantName of buildContext.themeNames) {
1246
- if (themeVariantName === themeName) {
1247
- continue;
1248
- }
1249
- (0,transformCodebase/* transformCodebase */.N)({
1250
- srcDirPath: (0,external_path_.join)(resourcesDirPath, "theme", themeName),
1251
- destDirPath: (0,external_path_.join)(resourcesDirPath, "theme", themeVariantName),
1252
- transformSourceCode: ({ fileRelativePath, sourceCode }) => {
1253
- if ((0,external_path_.extname)(fileRelativePath) === ".ftl" &&
1254
- fileRelativePath.split(external_path_.sep).length === 2) {
1255
- const modifiedSourceCode = Buffer.from(Buffer.from(sourceCode)
1256
- .toString("utf-8")
1257
- .replace(`"themeName": "${themeName}"`, `"themeName": "${themeVariantName}"`), "utf8");
1258
- (0,assert/* assert */.h)(Buffer.compare(modifiedSourceCode, sourceCode) !== 0);
1259
- return { modifiedSourceCode };
1243
+ for (const themeType of [...constants/* THEME_TYPES */.Jh, "email"]) {
1244
+ copy_main_theme_to_theme_variant_theme: {
1245
+ let isNative;
1246
+ {
1247
+ const v = buildContext.implementedThemeTypes[themeType];
1248
+ if (!v.isImplemented && !v.isImplemented_native) {
1249
+ break copy_main_theme_to_theme_variant_theme;
1250
+ }
1251
+ isNative = !v.isImplemented && v.isImplemented_native;
1260
1252
  }
1261
- return { modifiedSourceCode: sourceCode };
1253
+ if (themeVariantName === themeName) {
1254
+ break copy_main_theme_to_theme_variant_theme;
1255
+ }
1256
+ (0,transformCodebase/* transformCodebase */.N)({
1257
+ srcDirPath: (0,external_path_.join)(resourcesDirPath, "theme", themeName),
1258
+ destDirPath: (0,external_path_.join)(resourcesDirPath, "theme", themeVariantName),
1259
+ transformSourceCode: isNative
1260
+ ? undefined
1261
+ : ({ fileRelativePath, sourceCode }) => {
1262
+ if ((0,external_path_.extname)(fileRelativePath) === ".ftl" &&
1263
+ fileRelativePath.split(external_path_.sep).length === 2) {
1264
+ const modifiedSourceCode = Buffer.from(Buffer.from(sourceCode)
1265
+ .toString("utf-8")
1266
+ .replace(`"themeName": "${themeName}"`, `"themeName": "${themeVariantName}"`), "utf8");
1267
+ (0,assert/* assert */.h)(Buffer.compare(modifiedSourceCode, sourceCode) !== 0);
1268
+ return { modifiedSourceCode };
1269
+ }
1270
+ return { modifiedSourceCode: sourceCode };
1271
+ }
1272
+ });
1262
1273
  }
1263
- });
1264
- }
1265
- for (const themeName of buildContext.themeNames) {
1266
- for (const [themeType, writeMessagePropertiesFiles] of (0,objectEntries/* objectEntries */.q)(writeMessagePropertiesFilesByThemeType)) {
1267
- // NOTE: This is just a quirk of the type system: We can't really differentiate in a record
1268
- // between the case where the key isn't present and the case where the value is `undefined`.
1269
- if (writeMessagePropertiesFiles === undefined) {
1270
- return;
1274
+ run_writeMessagePropertiesFiles: {
1275
+ const writeMessagePropertiesFiles = writeMessagePropertiesFilesByThemeType[themeType];
1276
+ if (writeMessagePropertiesFiles === undefined) {
1277
+ break run_writeMessagePropertiesFiles;
1278
+ }
1279
+ writeMessagePropertiesFiles({
1280
+ messageDirPath: (0,external_path_.join)(getThemeTypeDirPath({ themeName: themeVariantName, themeType }), "messages"),
1281
+ themeName: themeVariantName
1282
+ });
1271
1283
  }
1272
- writeMessagePropertiesFiles({
1273
- messageDirPath: (0,external_path_.join)(getThemeTypeDirPath({ themeName, themeType }), "messages"),
1274
- themeName
1275
- });
1276
- }
1277
- }
1278
- modify_email_theme_per_variant: {
1279
- if (!buildContext.implementedThemeTypes.email.isImplemented) {
1280
- break modify_email_theme_per_variant;
1281
- }
1282
- for (const themeName of buildContext.themeNames) {
1283
- const emailThemeDirPath = getThemeTypeDirPath({
1284
- themeName,
1285
- themeType: "email"
1286
- });
1287
- (0,transformCodebase/* transformCodebase */.N)({
1288
- srcDirPath: emailThemeDirPath,
1289
- destDirPath: emailThemeDirPath,
1290
- transformSourceCode: ({ filePath, sourceCode }) => {
1291
- if (!filePath.endsWith(".ftl")) {
1292
- return { modifiedSourceCode: sourceCode };
1284
+ replace_xKeycloakify_themeName_in_native_ftl_files: {
1285
+ {
1286
+ const v = buildContext.implementedThemeTypes[themeType];
1287
+ if (v.isImplemented || !v.isImplemented_native) {
1288
+ break replace_xKeycloakify_themeName_in_native_ftl_files;
1293
1289
  }
1294
- return {
1295
- modifiedSourceCode: Buffer.from(sourceCode
1296
- .toString("utf8")
1297
- .replace(/xKeycloakify\.themeName/g, `"${themeName}"`), "utf8")
1298
- };
1299
1290
  }
1300
- });
1291
+ const emailThemeDirPath = getThemeTypeDirPath({
1292
+ themeName,
1293
+ themeType
1294
+ });
1295
+ (0,transformCodebase/* transformCodebase */.N)({
1296
+ srcDirPath: emailThemeDirPath,
1297
+ destDirPath: emailThemeDirPath,
1298
+ transformSourceCode: ({ filePath, sourceCode }) => {
1299
+ if (!filePath.endsWith(".ftl")) {
1300
+ return { modifiedSourceCode: sourceCode };
1301
+ }
1302
+ return {
1303
+ modifiedSourceCode: Buffer.from(sourceCode
1304
+ .toString("utf8")
1305
+ .replace(/xKeycloakify\.themeName/g, `"${themeName}"`), "utf8")
1306
+ };
1307
+ }
1308
+ });
1309
+ }
1301
1310
  }
1302
1311
  }
1303
1312
  }
@@ -1447,8 +1456,6 @@ function generatePom(params) {
1447
1456
  return { pomFileCode };
1448
1457
  }
1449
1458
  //# sourceMappingURL=generatePom.js.map
1450
- // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
1451
- var isInside = __webpack_require__(90665);
1452
1459
  // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
1453
1460
  var fs_existsAsync = __webpack_require__(43765);
1454
1461
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/buildJars/buildJar.js
@@ -1462,7 +1469,6 @@ var fs_existsAsync = __webpack_require__(43765);
1462
1469
 
1463
1470
 
1464
1471
 
1465
-
1466
1472
  (0,assert/* assert */.h)();
1467
1473
  async function buildJar(params) {
1468
1474
  const { jarFileBasename, keycloakAccountV1Version, keycloakThemeAdditionalInfoExtensionVersion, resourcesDirPath, doesImplementAccountV1Theme, buildContext } = params;
@@ -1495,23 +1501,28 @@ async function buildJar(params) {
1495
1501
  return { modifiedSourceCode: sourceCode };
1496
1502
  }
1497
1503
  });
1498
- remove_account_v1_in_meta_inf: {
1499
- if (!doesImplementAccountV1Theme) {
1500
- // NOTE: We do not have account v1 anyway
1501
- break remove_account_v1_in_meta_inf;
1502
- }
1503
- if (keycloakAccountV1Version !== null) {
1504
- // NOTE: No, we need to keep account-v1 in meta-inf
1505
- break remove_account_v1_in_meta_inf;
1506
- }
1507
- writeMetaInfKeycloakThemes({
1508
- resourcesDirPath: tmpResourcesDirPath,
1509
- getNewMetaInfKeycloakTheme: ({ metaInfKeycloakTheme }) => {
1510
- (0,assert/* assert */.h)(metaInfKeycloakTheme !== undefined);
1511
- metaInfKeycloakTheme.themes = metaInfKeycloakTheme.themes.filter(({ name }) => name !== "account-v1");
1512
- return metaInfKeycloakTheme;
1513
- }
1514
- });
1504
+ {
1505
+ const filePath = (0,external_path_.join)(tmpResourcesDirPath, "META-INF", "keycloak-themes.json");
1506
+ await promises_.mkdir((0,external_path_.dirname)(filePath));
1507
+ await promises_.writeFile(filePath, Buffer.from(JSON.stringify({
1508
+ themes: await (async () => {
1509
+ const dirPath = (0,external_path_.join)(tmpResourcesDirPath, "theme");
1510
+ const themeNames = (await promises_.readdir(dirPath)).sort((a, b) => {
1511
+ const indexA = buildContext.themeNames.indexOf(a);
1512
+ const indexB = buildContext.themeNames.indexOf(b);
1513
+ const orderA = indexA === -1 ? Infinity : indexA;
1514
+ const orderB = indexB === -1 ? Infinity : indexB;
1515
+ return orderA - orderB;
1516
+ });
1517
+ return Promise.all(themeNames.map(async (themeName) => {
1518
+ const types = await promises_.readdir((0,external_path_.join)(dirPath, themeName));
1519
+ return {
1520
+ name: themeName,
1521
+ types
1522
+ };
1523
+ }));
1524
+ })()
1525
+ }, null, 2), "utf8"));
1515
1526
  }
1516
1527
  route_legacy_pages: {
1517
1528
  if (!buildContext.implementedThemeTypes.login.isImplemented) {
package/bin/780.index.js CHANGED
@@ -109,11 +109,6 @@ async function command(params) {
109
109
  return;
110
110
  }
111
111
  const accountThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "account");
112
- if (external_fs_.existsSync(accountThemeSrcDirPath) &&
113
- external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
114
- console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
115
- process.exit(-1);
116
- }
117
112
  (0,exitIfUncommittedChanges/* exitIfUncommittedChanges */.l)({
118
113
  projectDirPath: buildContext.projectDirPath
119
114
  });
@@ -124,11 +119,18 @@ async function command(params) {
124
119
  });
125
120
  switch (accountThemeType) {
126
121
  case "Multi-Page":
127
- external_fs_.cpSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "initialize-account-theme", "multi-page-boilerplate"), accountThemeSrcDirPath, { recursive: true });
122
+ {
123
+ if (external_fs_.existsSync(accountThemeSrcDirPath) &&
124
+ external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
125
+ console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
126
+ process.exit(-1);
127
+ }
128
+ external_fs_.cpSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "initialize-account-theme", "multi-page-boilerplate"), accountThemeSrcDirPath, { recursive: true });
129
+ }
128
130
  break;
129
131
  case "Single-Page":
130
132
  {
131
- const { initializeSpa } = await __webpack_require__.e(/* import() */ 288).then(__webpack_require__.bind(__webpack_require__, 27288));
133
+ const { initializeSpa } = await Promise.all(/* import() */[__webpack_require__.e(502), __webpack_require__.e(656)]).then(__webpack_require__.bind(__webpack_require__, 98656));
132
134
  await initializeSpa({
133
135
  themeType: "account",
134
136
  buildContext