keycloakify 10.0.0-rc.63 → 10.0.0-rc.65

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 (34) hide show
  1. package/account/KcContext/KcContext.d.ts +1 -0
  2. package/account/KcContext/KcContext.js.map +1 -1
  3. package/account/KcContext/kcContextMocks.js +2 -1
  4. package/account/KcContext/kcContextMocks.js.map +1 -1
  5. package/account/pages/Totp.js +2 -7
  6. package/account/pages/Totp.js.map +1 -1
  7. package/bin/190.index.js +67 -101
  8. package/bin/{991.index.js → 203.index.js} +40 -19
  9. package/bin/{952.index.js → 363.index.js} +174 -154
  10. package/bin/{214.index.js → 430.index.js} +2 -161
  11. package/bin/526.index.js +130 -90
  12. package/bin/538.index.js +37 -28
  13. package/bin/{98.index.js → 827.index.js} +39 -187
  14. package/bin/{941.index.js → 890.index.js} +159 -2
  15. package/bin/932.index.js +104 -129
  16. package/bin/97.index.js +1 -1
  17. package/bin/main.js +7 -7
  18. package/package.json +9 -8
  19. package/src/account/KcContext/KcContext.ts +1 -0
  20. package/src/account/KcContext/kcContextMocks.ts +2 -1
  21. package/src/account/pages/Totp.tsx +1 -7
  22. package/src/bin/add-story.ts +1 -1
  23. package/src/bin/keycloakify/buildJars/buildJar.ts +24 -27
  24. package/src/bin/keycloakify/buildJars/buildJars.ts +5 -5
  25. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +8 -6
  26. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +33 -32
  27. package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +22 -26
  28. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +135 -108
  29. package/src/bin/shared/getImplementedThemeTypes.ts +38 -0
  30. package/src/bin/shared/getThemeSrcDirPath.ts +44 -32
  31. package/src/bin/shared/metaInfKeycloakThemes.ts +16 -60
  32. package/src/bin/start-keycloak/keycloakifyBuild.ts +1 -1
  33. package/src/bin/start-keycloak/start-keycloak.ts +35 -70
  34. package/vite-plugin/index.js +1917 -100
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.id = 952;
3
- exports.ids = [952];
2
+ exports.id = 363;
3
+ exports.ids = [363];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 73817:
@@ -155,7 +155,7 @@ function generateMessageProperties(params) {
155
155
 
156
156
  /***/ }),
157
157
 
158
- /***/ 24952:
158
+ /***/ 52363:
159
159
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
160
160
 
161
161
  // ESM COMPAT FLAG
@@ -514,8 +514,6 @@ function generateFtlFilesCodeFactory(params) {
514
514
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateFtl/index.js
515
515
 
516
516
  //# sourceMappingURL=index.js.map
517
- // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
518
- var isInside = __webpack_require__(90665);
519
517
  // EXTERNAL MODULE: ./dist/bin/shared/downloadKeycloakStaticResources.js
520
518
  var downloadKeycloakStaticResources = __webpack_require__(62190);
521
519
  // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
@@ -686,12 +684,33 @@ var getThemeSrcDirPath = __webpack_require__(39216);
686
684
  var fs_rmSync = __webpack_require__(89693);
687
685
  // EXTERNAL MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
688
686
  var readThisNpmPackageVersion = __webpack_require__(64795);
689
- // EXTERNAL MODULE: ./dist/bin/shared/metaInfKeycloakThemes.js
690
- var shared_metaInfKeycloakThemes = __webpack_require__(26914);
687
+ ;// CONCATENATED MODULE: ./dist/bin/shared/metaInfKeycloakThemes.js
688
+
689
+
690
+ function writeMetaInfKeycloakThemes(params) {
691
+ const { resourcesDirPath, getNewMetaInfKeycloakTheme } = params;
692
+ const filePath = (0,external_path_.join)(resourcesDirPath, "META-INF", "keycloak-themes.json");
693
+ const currentMetaInfKeycloakTheme = !external_fs_.existsSync(filePath)
694
+ ? undefined
695
+ : JSON.parse(external_fs_.readFileSync(filePath).toString("utf8"));
696
+ const newMetaInfKeycloakThemes = getNewMetaInfKeycloakTheme({
697
+ metaInfKeycloakTheme: currentMetaInfKeycloakTheme
698
+ });
699
+ {
700
+ const dirPath = (0,external_path_.dirname)(filePath);
701
+ if (!external_fs_.existsSync(dirPath)) {
702
+ external_fs_.mkdirSync(dirPath, { recursive: true });
703
+ }
704
+ }
705
+ external_fs_.writeFileSync(filePath, Buffer.from(JSON.stringify(newMetaInfKeycloakThemes, null, 2), "utf8"));
706
+ }
707
+ //# sourceMappingURL=metaInfKeycloakThemes.js.map
691
708
  // EXTERNAL MODULE: ./node_modules/tsafe/objectEntries.js
692
709
  var objectEntries = __webpack_require__(39612);
693
710
  // EXTERNAL MODULE: ./dist/bin/tools/escapeStringForPropertiesFile.js
694
711
  var escapeStringForPropertiesFile = __webpack_require__(27190);
712
+ // EXTERNAL MODULE: ./dist/bin/shared/getImplementedThemeTypes.js
713
+ var getImplementedThemeTypes = __webpack_require__(64409);
695
714
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateResources/generateResourcesForMainTheme.js
696
715
 
697
716
 
@@ -720,21 +739,18 @@ async function generateResourcesForMainTheme(params) {
720
739
  const { themeSrcDirPath } = (0,getThemeSrcDirPath/* getThemeSrcDirPath */.f)({
721
740
  projectDirPath: buildContext.projectDirPath
722
741
  });
742
+ const { implementedThemeTypes } = (0,getImplementedThemeTypes/* getImplementedThemeTypes */.C)({
743
+ projectDirPath: buildContext.projectDirPath
744
+ });
723
745
  const getThemeTypeDirPath = (params) => {
724
746
  const { themeType } = params;
725
747
  return (0,external_path_.join)(resourcesDirPath, "theme", themeName, themeType);
726
748
  };
727
749
  const cssGlobalsToDefine = {};
728
- const implementedThemeTypes = {
729
- login: false,
730
- account: false,
731
- email: false
732
- };
733
750
  for (const themeType of ["login", "account"]) {
734
- if (!external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, themeType))) {
751
+ if (!implementedThemeTypes[themeType]) {
735
752
  continue;
736
753
  }
737
- implementedThemeTypes[themeType] = true;
738
754
  const themeTypeDirPath = getThemeTypeDirPath({ themeType });
739
755
  apply_replacers_and_move_to_theme_resources: {
740
756
  const destDirPath = (0,external_path_.join)(themeTypeDirPath, "resources", constants/* basenameOfTheKeycloakifyResourcesDir */.M);
@@ -750,19 +766,24 @@ async function generateResourcesForMainTheme(params) {
750
766
  });
751
767
  break apply_replacers_and_move_to_theme_resources;
752
768
  }
769
+ {
770
+ const dirPath = (0,external_path_.join)(buildContext.projectBuildDirPath, constants/* keycloak_resources */.N$);
771
+ if (external_fs_.existsSync(dirPath)) {
772
+ (0,assert.assert)(buildContext.bundler === "webpack");
773
+ throw new Error([
774
+ `Keycloakify build error: The ${constants/* keycloak_resources */.N$} directory shouldn't exist in your build directory.`,
775
+ `(${(0,external_path_.relative)(process.cwd(), dirPath)}).\n`,
776
+ `Theses assets are only required for local development with Storybook.",
777
+ "Please remove this directory as an additional step of your command.\n`,
778
+ `For example: \`"build": "... && rimraf ${(0,external_path_.relative)(buildContext.projectDirPath, dirPath)}"\``
779
+ ].join(" "));
780
+ }
781
+ }
753
782
  (0,transformCodebase/* transformCodebase */.N)({
754
783
  srcDirPath: buildContext.projectBuildDirPath,
755
784
  destDirPath,
756
785
  transformSourceCode: ({ filePath, sourceCode }) => {
757
- //NOTE: Prevent cycles, excludes the folder we generated for debug in public/
758
- // This should not happen if users follow the new instruction setup but we keep it for retrocompatibility.
759
- if ((0,isInside/* isInside */.V)({
760
- dirPath: (0,external_path_.join)(buildContext.projectBuildDirPath, constants/* keycloak_resources */.N$),
761
- filePath
762
- })) {
763
- return undefined;
764
- }
765
- if (/\.css?$/i.test(filePath)) {
786
+ if (filePath.endsWith(".css")) {
766
787
  const { cssGlobalsToDefine: cssGlobalsToDefineForThisFile, fixedCssCode } = replaceImportsInCssCode({
767
788
  cssCode: sourceCode.toString("utf8")
768
789
  });
@@ -773,7 +794,7 @@ async function generateResourcesForMainTheme(params) {
773
794
  modifiedSourceCode: Buffer.from(fixedCssCode, "utf8")
774
795
  };
775
796
  }
776
- if (/\.js?$/i.test(filePath)) {
797
+ if (filePath.endsWith(".js")) {
777
798
  const { fixedJsCode } = replaceImportsInJsCode({
778
799
  jsCode: sourceCode.toString("utf8"),
779
800
  buildContext
@@ -855,11 +876,10 @@ async function generateResourcesForMainTheme(params) {
855
876
  ].join("\n\n"), "utf8"));
856
877
  }
857
878
  email: {
858
- const emailThemeSrcDirPath = (0,external_path_.join)(themeSrcDirPath, "email");
859
- if (!external_fs_.existsSync(emailThemeSrcDirPath)) {
879
+ if (!implementedThemeTypes.email) {
860
880
  break email;
861
881
  }
862
- implementedThemeTypes.email = true;
882
+ const emailThemeSrcDirPath = (0,external_path_.join)(themeSrcDirPath, "email");
863
883
  (0,transformCodebase/* transformCodebase */.N)({
864
884
  srcDirPath: emailThemeSrcDirPath,
865
885
  destDirPath: getThemeTypeDirPath({ themeType: "email" })
@@ -885,9 +905,9 @@ async function generateResourcesForMainTheme(params) {
885
905
  types: ["account"]
886
906
  });
887
907
  }
888
- (0,shared_metaInfKeycloakThemes/* writeMetaInfKeycloakThemes */.JJ)({
908
+ writeMetaInfKeycloakThemes({
889
909
  resourcesDirPath,
890
- metaInfKeycloakThemes
910
+ getNewMetaInfKeycloakTheme: () => metaInfKeycloakThemes
891
911
  });
892
912
  }
893
913
  }
@@ -909,30 +929,29 @@ function generateResourcesForThemeVariant(params) {
909
929
  fileRelativePath.split(external_path_.sep).length === 2) {
910
930
  const modifiedSourceCode = Buffer.from(Buffer.from(sourceCode)
911
931
  .toString("utf-8")
912
- .replace(`out["themeName"] = "${themeName}";`, `out["themeName"] = "${themeVariantName}";`), "utf8");
932
+ .replace(`kcContext.themeName = "${themeName}";`, `kcContext.themeName = "${themeVariantName}";`), "utf8");
913
933
  (0,assert.assert)(Buffer.compare(modifiedSourceCode, sourceCode) !== 0);
914
934
  return { modifiedSourceCode };
915
935
  }
916
936
  return { modifiedSourceCode: sourceCode };
917
937
  }
918
938
  });
919
- {
920
- const updatedMetaInfKeycloakThemes = (0,shared_metaInfKeycloakThemes/* readMetaInfKeycloakThemes_fromResourcesDirPath */.Ju)({
921
- resourcesDirPath
922
- });
923
- updatedMetaInfKeycloakThemes.themes.push({
924
- name: themeVariantName,
925
- types: (() => {
926
- const theme = updatedMetaInfKeycloakThemes.themes.find(({ name }) => name === themeName);
927
- (0,assert.assert)(theme !== undefined);
928
- return theme.types;
929
- })()
930
- });
931
- (0,shared_metaInfKeycloakThemes/* writeMetaInfKeycloakThemes */.JJ)({
932
- resourcesDirPath,
933
- metaInfKeycloakThemes: updatedMetaInfKeycloakThemes
934
- });
935
- }
939
+ writeMetaInfKeycloakThemes({
940
+ resourcesDirPath,
941
+ getNewMetaInfKeycloakTheme: ({ metaInfKeycloakTheme }) => {
942
+ (0,assert.assert)(metaInfKeycloakTheme !== undefined);
943
+ const newMetaInfKeycloakTheme = metaInfKeycloakTheme;
944
+ newMetaInfKeycloakTheme.themes.push({
945
+ name: themeVariantName,
946
+ types: (() => {
947
+ const theme = newMetaInfKeycloakTheme.themes.find(({ name }) => name === themeName);
948
+ (0,assert.assert)(theme !== undefined);
949
+ return theme.types;
950
+ })()
951
+ });
952
+ return newMetaInfKeycloakTheme;
953
+ }
954
+ });
936
955
  }
937
956
  //# sourceMappingURL=generateResourcesForThemeVariant.js.map
938
957
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateResources/generateResources.js
@@ -1111,6 +1130,8 @@ function generatePom(params) {
1111
1130
  return { pomFileCode };
1112
1131
  }
1113
1132
  //# sourceMappingURL=generatePom.js.map
1133
+ // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
1134
+ var isInside = __webpack_require__(90665);
1114
1135
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/buildJars/buildJar.js
1115
1136
 
1116
1137
 
@@ -1128,9 +1149,10 @@ async function buildJar(params) {
1128
1149
  const { jarFileBasename, keycloakAccountV1Version, keycloakThemeAdditionalInfoExtensionVersion, resourcesDirPath, buildContext } = params;
1129
1150
  const keycloakifyBuildTmpDirPath = (0,external_path_.join)(buildContext.cacheDirPath, jarFileBasename.replace(".jar", ""));
1130
1151
  (0,fs_rmSync/* rmSync */.a)(keycloakifyBuildTmpDirPath, { recursive: true, force: true });
1152
+ const tmpResourcesDirPath = (0,external_path_.join)(keycloakifyBuildTmpDirPath, "src", "main", "resources");
1131
1153
  (0,transformCodebase/* transformCodebase */.N)({
1132
1154
  srcDirPath: resourcesDirPath,
1133
- destDirPath: (0,external_path_.join)(keycloakifyBuildTmpDirPath, "src", "main", "resources"),
1155
+ destDirPath: tmpResourcesDirPath,
1134
1156
  transformSourceCode: keycloakAccountV1Version !== null
1135
1157
  ? undefined
1136
1158
  : (params) => {
@@ -1141,17 +1163,6 @@ async function buildJar(params) {
1141
1163
  })) {
1142
1164
  return undefined;
1143
1165
  }
1144
- if (fileRelativePath ===
1145
- (0,shared_metaInfKeycloakThemes/* getMetaInfKeycloakThemesJsonFilePath */.KQ)({
1146
- resourcesDirPath: "."
1147
- })) {
1148
- const keycloakThemesJsonParsed = JSON.parse(sourceCode.toString("utf8"));
1149
- keycloakThemesJsonParsed.themes =
1150
- keycloakThemesJsonParsed.themes.filter(({ name }) => name !== constants/* accountV1ThemeName */.y_);
1151
- return {
1152
- modifiedSourceCode: Buffer.from(JSON.stringify(keycloakThemesJsonParsed, null, 2), "utf8")
1153
- };
1154
- }
1155
1166
  for (const themeName of buildContext.themeNames) {
1156
1167
  if (fileRelativePath ===
1157
1168
  (0,external_path_.join)("theme", themeName, "account", "theme.properties")) {
@@ -1165,6 +1176,16 @@ async function buildJar(params) {
1165
1176
  return { modifiedSourceCode: sourceCode };
1166
1177
  }
1167
1178
  });
1179
+ if (keycloakAccountV1Version === null) {
1180
+ writeMetaInfKeycloakThemes({
1181
+ resourcesDirPath: tmpResourcesDirPath,
1182
+ getNewMetaInfKeycloakTheme: ({ metaInfKeycloakTheme }) => {
1183
+ (0,assert.assert)(metaInfKeycloakTheme !== undefined);
1184
+ metaInfKeycloakTheme.themes = metaInfKeycloakTheme.themes.filter(({ name }) => name !== constants/* accountV1ThemeName */.y_);
1185
+ return metaInfKeycloakTheme;
1186
+ }
1187
+ });
1188
+ }
1168
1189
  route_legacy_pages: {
1169
1190
  // NOTE: If there's no account theme there is no special target for keycloak 24 and up so we create
1170
1191
  // the pages anyway. If there is an account pages, since we know that account-v1 is only support keycloak
@@ -1233,13 +1254,12 @@ var getJarFileBasename = __webpack_require__(2323);
1233
1254
 
1234
1255
 
1235
1256
 
1236
-
1237
1257
  (0,assert.assert)();
1238
1258
  async function buildJars(params) {
1239
1259
  const { onlyBuildJarFileBasename, resourcesDirPath, buildContext } = params;
1240
- const doesImplementAccountTheme = (0,shared_metaInfKeycloakThemes/* readMetaInfKeycloakThemes_fromResourcesDirPath */.Ju)({
1241
- resourcesDirPath
1242
- }).themes.some(({ name }) => name === constants/* accountV1ThemeName */.y_);
1260
+ const doesImplementAccountTheme = (0,getImplementedThemeTypes/* getImplementedThemeTypes */.C)({
1261
+ projectDirPath: buildContext.projectDirPath
1262
+ }).implementedThemeTypes.account;
1243
1263
  await Promise.all(keycloakAccountV1Versions.map(keycloakAccountV1Version => keycloakThemeAdditionalInfoExtensionVersions.map(keycloakThemeAdditionalInfoExtensionVersion => {
1244
1264
  const keycloakVersionRange = getKeycloakVersionRangeForJar({
1245
1265
  doesImplementAccountTheme,
@@ -1369,6 +1389,44 @@ async function command(params) {
1369
1389
 
1370
1390
  /***/ }),
1371
1391
 
1392
+ /***/ 64409:
1393
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1394
+
1395
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1396
+ /* harmony export */ "C": () => (/* binding */ getImplementedThemeTypes)
1397
+ /* harmony export */ });
1398
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1399
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1400
+ /* harmony import */ var tsafe_objectFromEntries__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(68634);
1401
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57147);
1402
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
1403
+ /* harmony import */ var _getThemeSrcDirPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39216);
1404
+
1405
+
1406
+
1407
+
1408
+ let cache;
1409
+ function getImplementedThemeTypes(params) {
1410
+ const { projectDirPath } = params;
1411
+ if (cache !== undefined && cache.projectDirPath === projectDirPath) {
1412
+ const { implementedThemeTypes } = cache;
1413
+ return { implementedThemeTypes };
1414
+ }
1415
+ cache = undefined;
1416
+ const { themeSrcDirPath } = (0,_getThemeSrcDirPath__WEBPACK_IMPORTED_MODULE_3__/* .getThemeSrcDirPath */ .f)({
1417
+ projectDirPath
1418
+ });
1419
+ const implementedThemeTypes = (0,tsafe_objectFromEntries__WEBPACK_IMPORTED_MODULE_1__.objectFromEntries)(["login", "account", "email"].map(themeType => [
1420
+ themeType,
1421
+ fs__WEBPACK_IMPORTED_MODULE_2__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_0__.join)(themeSrcDirPath, themeType))
1422
+ ]));
1423
+ cache = { projectDirPath, implementedThemeTypes };
1424
+ return { implementedThemeTypes };
1425
+ }
1426
+ //# sourceMappingURL=getImplementedThemeTypes.js.map
1427
+
1428
+ /***/ }),
1429
+
1372
1430
  /***/ 2323:
1373
1431
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1374
1432
 
@@ -1398,111 +1456,56 @@ function getJarFileBasename(params) {
1398
1456
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71017);
1399
1457
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
1400
1458
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(173);
1459
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78818);
1460
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_5__);
1401
1461
 
1402
1462
 
1403
1463
 
1404
1464
 
1405
1465
 
1406
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
1466
+
1467
+ let cache = undefined;
1407
1468
  /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
1408
1469
  function getThemeSrcDirPath(params) {
1409
1470
  const { projectDirPath } = params;
1410
- const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(projectDirPath, "src");
1411
- const themeSrcDirPath = (0,_tools_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
1412
- dirPath: srcDirPath,
1413
- returnedPathsType: "relative to dirPath"
1414
- })
1415
- .map(fileRelativePath => {
1416
- for (const themeSrcDirBasename of themeSrcDirBasenames) {
1417
- const split = fileRelativePath.split(themeSrcDirBasename);
1418
- if (split.length === 2) {
1419
- return (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, split[0] + themeSrcDirBasename);
1420
- }
1421
- }
1422
- return undefined;
1423
- })
1424
- .filter((0,tsafe__WEBPACK_IMPORTED_MODULE_1__.exclude)(undefined))[0];
1425
- if (themeSrcDirPath !== undefined) {
1471
+ if (cache !== undefined && cache.projectDirPath === projectDirPath) {
1472
+ const { themeSrcDirPath } = cache;
1426
1473
  return { themeSrcDirPath };
1427
1474
  }
1428
- for (const themeType of [..._constants__WEBPACK_IMPORTED_MODULE_4__/* .themeTypes */ .rO, "email"]) {
1429
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, themeType))) {
1430
- continue;
1431
- }
1432
- return { themeSrcDirPath: srcDirPath };
1433
- }
1434
- console.error([
1435
- "Can't locate your theme source directory. It should be either: ",
1436
- "src/ or src/keycloak-theme or src/keycloak_theme.",
1437
- "Example in the starter: https://github.com/keycloakify/keycloakify-starter/tree/main/src/keycloak-theme"
1438
- ].join("\n"));
1439
- process.exit(-1);
1440
- }
1441
- //# sourceMappingURL=getThemeSrcDirPath.js.map
1442
-
1443
- /***/ }),
1444
-
1445
- /***/ 26914:
1446
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1447
-
1448
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1449
- /* harmony export */ "IS": () => (/* binding */ readMetaInfKeycloakThemes_fromJar),
1450
- /* harmony export */ "JJ": () => (/* binding */ writeMetaInfKeycloakThemes),
1451
- /* harmony export */ "Ju": () => (/* binding */ readMetaInfKeycloakThemes_fromResourcesDirPath),
1452
- /* harmony export */ "KQ": () => (/* binding */ getMetaInfKeycloakThemesJsonFilePath)
1453
- /* harmony export */ });
1454
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1455
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1456
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57147);
1457
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
1458
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88078);
1459
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(tsafe_assert__WEBPACK_IMPORTED_MODULE_2__);
1460
- /* harmony import */ var _tools_extractArchive__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29121);
1461
-
1462
-
1463
-
1464
-
1465
- function getMetaInfKeycloakThemesJsonFilePath(params) {
1466
- const { resourcesDirPath } = params;
1467
- return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(resourcesDirPath === "." ? "" : resourcesDirPath, "META-INF", "keycloak-themes.json");
1468
- }
1469
- function readMetaInfKeycloakThemes_fromResourcesDirPath(params) {
1470
- const { resourcesDirPath } = params;
1471
- return JSON.parse(fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(getMetaInfKeycloakThemesJsonFilePath({
1472
- resourcesDirPath
1473
- }))
1474
- .toString("utf8"));
1475
- }
1476
- async function readMetaInfKeycloakThemes_fromJar(params) {
1477
- const { jarFilePath } = params;
1478
- let metaInfKeycloakThemes = undefined;
1479
- await (0,_tools_extractArchive__WEBPACK_IMPORTED_MODULE_3__/* .extractArchive */ .N)({
1480
- archiveFilePath: jarFilePath,
1481
- onArchiveFile: async ({ relativeFilePathInArchive, readFile, earlyExit }) => {
1482
- if (relativeFilePathInArchive ===
1483
- getMetaInfKeycloakThemesJsonFilePath({ resourcesDirPath: "." })) {
1484
- metaInfKeycloakThemes = JSON.parse((await readFile()).toString("utf8"));
1485
- earlyExit();
1475
+ cache = undefined;
1476
+ const { themeSrcDirPath } = (() => {
1477
+ const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(projectDirPath, "src");
1478
+ const themeSrcDirPath = (0,_tools_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
1479
+ dirPath: srcDirPath,
1480
+ returnedPathsType: "relative to dirPath"
1481
+ })
1482
+ .map(fileRelativePath => {
1483
+ for (const themeSrcDirBasename of themeSrcDirBasenames) {
1484
+ const split = fileRelativePath.split(themeSrcDirBasename);
1485
+ if (split.length === 2) {
1486
+ return (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, split[0] + themeSrcDirBasename);
1487
+ }
1486
1488
  }
1489
+ return undefined;
1490
+ })
1491
+ .filter((0,tsafe__WEBPACK_IMPORTED_MODULE_1__.exclude)(undefined))[0];
1492
+ if (themeSrcDirPath !== undefined) {
1493
+ return { themeSrcDirPath };
1487
1494
  }
1488
- });
1489
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__.assert)(metaInfKeycloakThemes !== undefined);
1490
- return metaInfKeycloakThemes;
1491
- }
1492
- function writeMetaInfKeycloakThemes(params) {
1493
- const { resourcesDirPath, metaInfKeycloakThemes } = params;
1494
- const metaInfKeycloakThemesJsonPath = getMetaInfKeycloakThemesJsonFilePath({
1495
- resourcesDirPath
1496
- });
1497
- {
1498
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(metaInfKeycloakThemesJsonPath);
1499
- if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(dirPath)) {
1500
- fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(dirPath, { recursive: true });
1495
+ for (const themeType of [..._constants__WEBPACK_IMPORTED_MODULE_4__/* .themeTypes */ .rO, "email"]) {
1496
+ if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, themeType))) {
1497
+ continue;
1498
+ }
1499
+ return { themeSrcDirPath: srcDirPath };
1501
1500
  }
1502
- }
1503
- fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(metaInfKeycloakThemesJsonPath, Buffer.from(JSON.stringify(metaInfKeycloakThemes, null, 2), "utf8"));
1501
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_5___default().red("Can't locate your theme source directory. It should be either: "));
1502
+ process.exit(-1);
1503
+ })();
1504
+ cache = { projectDirPath, themeSrcDirPath };
1505
+ return { themeSrcDirPath };
1504
1506
  }
1505
- //# sourceMappingURL=metaInfKeycloakThemes.js.map
1507
+ const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
1508
+ //# sourceMappingURL=getThemeSrcDirPath.js.map
1506
1509
 
1507
1510
  /***/ }),
1508
1511
 
@@ -1577,6 +1580,23 @@ function escapeStringForPropertiesFile(str) {
1577
1580
  }
1578
1581
  //# sourceMappingURL=escapeStringForPropertiesFile.js.map
1579
1582
 
1583
+ /***/ }),
1584
+
1585
+ /***/ 90665:
1586
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1587
+
1588
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1589
+ /* harmony export */ "V": () => (/* binding */ isInside)
1590
+ /* harmony export */ });
1591
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1592
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1593
+
1594
+ function isInside(params) {
1595
+ const { dirPath, filePath } = params;
1596
+ return !(0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(dirPath, filePath).startsWith("..");
1597
+ }
1598
+ //# sourceMappingURL=isInside.js.map
1599
+
1580
1600
  /***/ })
1581
1601
 
1582
1602
  };
@@ -1,5 +1,5 @@
1
- exports.id = 214;
2
- exports.ids = [214];
1
+ exports.id = 430;
2
+ exports.ids = [430];
3
3
  exports.modules = {
4
4
 
5
5
  /***/ 84794:
@@ -478,22 +478,6 @@ function createFromFd(fd, options) {
478
478
  }
479
479
 
480
480
 
481
- /***/ }),
482
-
483
- /***/ 31621:
484
- /***/ ((module) => {
485
-
486
- "use strict";
487
-
488
-
489
- module.exports = (flag, argv = process.argv) => {
490
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
491
- const position = argv.indexOf(prefix + flag);
492
- const terminatorPosition = argv.indexOf('--');
493
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
494
- };
495
-
496
-
497
481
  /***/ }),
498
482
 
499
483
  /***/ 54833:
@@ -556,149 +540,6 @@ function pendGo(self, fn) {
556
540
  }
557
541
 
558
542
 
559
- /***/ }),
560
-
561
- /***/ 59318:
562
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
563
-
564
- "use strict";
565
-
566
- const os = __webpack_require__(22037);
567
- const tty = __webpack_require__(76224);
568
- const hasFlag = __webpack_require__(31621);
569
-
570
- const {env} = process;
571
-
572
- let forceColor;
573
- if (hasFlag('no-color') ||
574
- hasFlag('no-colors') ||
575
- hasFlag('color=false') ||
576
- hasFlag('color=never')) {
577
- forceColor = 0;
578
- } else if (hasFlag('color') ||
579
- hasFlag('colors') ||
580
- hasFlag('color=true') ||
581
- hasFlag('color=always')) {
582
- forceColor = 1;
583
- }
584
-
585
- if ('FORCE_COLOR' in env) {
586
- if (env.FORCE_COLOR === 'true') {
587
- forceColor = 1;
588
- } else if (env.FORCE_COLOR === 'false') {
589
- forceColor = 0;
590
- } else {
591
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
592
- }
593
- }
594
-
595
- function translateLevel(level) {
596
- if (level === 0) {
597
- return false;
598
- }
599
-
600
- return {
601
- level,
602
- hasBasic: true,
603
- has256: level >= 2,
604
- has16m: level >= 3
605
- };
606
- }
607
-
608
- function supportsColor(haveStream, streamIsTTY) {
609
- if (forceColor === 0) {
610
- return 0;
611
- }
612
-
613
- if (hasFlag('color=16m') ||
614
- hasFlag('color=full') ||
615
- hasFlag('color=truecolor')) {
616
- return 3;
617
- }
618
-
619
- if (hasFlag('color=256')) {
620
- return 2;
621
- }
622
-
623
- if (haveStream && !streamIsTTY && forceColor === undefined) {
624
- return 0;
625
- }
626
-
627
- const min = forceColor || 0;
628
-
629
- if (env.TERM === 'dumb') {
630
- return min;
631
- }
632
-
633
- if (process.platform === 'win32') {
634
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
635
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
636
- const osRelease = os.release().split('.');
637
- if (
638
- Number(osRelease[0]) >= 10 &&
639
- Number(osRelease[2]) >= 10586
640
- ) {
641
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
642
- }
643
-
644
- return 1;
645
- }
646
-
647
- if ('CI' in env) {
648
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
649
- return 1;
650
- }
651
-
652
- return min;
653
- }
654
-
655
- if ('TEAMCITY_VERSION' in env) {
656
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
657
- }
658
-
659
- if (env.COLORTERM === 'truecolor') {
660
- return 3;
661
- }
662
-
663
- if ('TERM_PROGRAM' in env) {
664
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
665
-
666
- switch (env.TERM_PROGRAM) {
667
- case 'iTerm.app':
668
- return version >= 3 ? 3 : 2;
669
- case 'Apple_Terminal':
670
- return 2;
671
- // No default
672
- }
673
- }
674
-
675
- if (/-256(color)?$/i.test(env.TERM)) {
676
- return 2;
677
- }
678
-
679
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
680
- return 1;
681
- }
682
-
683
- if ('COLORTERM' in env) {
684
- return 1;
685
- }
686
-
687
- return min;
688
- }
689
-
690
- function getSupportLevel(stream) {
691
- const level = supportsColor(stream, stream && stream.isTTY);
692
- return translateLevel(level);
693
- }
694
-
695
- module.exports = {
696
- supportsColor: getSupportLevel,
697
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
698
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
699
- };
700
-
701
-
702
543
  /***/ }),
703
544
 
704
545
  /***/ 78781: