keycloakify 10.0.0-rc.62 → 10.0.0-rc.64

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.
@@ -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,478 @@ async function command(params) {
1369
1389
 
1370
1390
  /***/ }),
1371
1391
 
1392
+ /***/ 47802:
1393
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1394
+
1395
+
1396
+ // EXPORTS
1397
+ __webpack_require__.d(__webpack_exports__, {
1398
+ "x": () => (/* binding */ downloadKeycloakDefaultTheme)
1399
+ });
1400
+
1401
+ // EXTERNAL MODULE: external "path"
1402
+ var external_path_ = __webpack_require__(71017);
1403
+ // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
1404
+ var assert = __webpack_require__(88078);
1405
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
1406
+ var constants = __webpack_require__(173);
1407
+ // EXTERNAL MODULE: ./node_modules/make-fetch-happen/lib/index.js
1408
+ var lib = __webpack_require__(9525);
1409
+ var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
1410
+ // EXTERNAL MODULE: external "fs/promises"
1411
+ var promises_ = __webpack_require__(73292);
1412
+ // EXTERNAL MODULE: ./dist/bin/tools/extractArchive.js
1413
+ var extractArchive = __webpack_require__(29121);
1414
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
1415
+ var fs_existsAsync = __webpack_require__(43765);
1416
+ // EXTERNAL MODULE: external "child_process"
1417
+ var external_child_process_ = __webpack_require__(32081);
1418
+ // EXTERNAL MODULE: external "util"
1419
+ var external_util_ = __webpack_require__(73837);
1420
+ ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/fetchProxyOptions.js
1421
+
1422
+
1423
+
1424
+ function ensureArray(arg0) {
1425
+ return Array.isArray(arg0) ? arg0 : typeof arg0 === "undefined" ? [] : [arg0];
1426
+ }
1427
+ function ensureSingleOrNone(arg0) {
1428
+ if (!Array.isArray(arg0))
1429
+ return arg0;
1430
+ if (arg0.length === 0)
1431
+ return undefined;
1432
+ if (arg0.length === 1)
1433
+ return arg0[0];
1434
+ throw new Error("Illegal configuration, expected a single value but found multiple: " +
1435
+ arg0.map(String).join(", "));
1436
+ }
1437
+ /**
1438
+ * Get npm configuration as map
1439
+ */
1440
+ async function getNmpConfig(params) {
1441
+ const { npmWorkspaceRootDirPath } = params;
1442
+ const exec = (0,external_util_.promisify)(external_child_process_.exec);
1443
+ const stdout = await exec("npm config get", {
1444
+ encoding: "utf8",
1445
+ cwd: npmWorkspaceRootDirPath
1446
+ }).then(({ stdout }) => stdout);
1447
+ const npmConfigReducer = (cfg, [key, value]) => key in cfg
1448
+ ? Object.assign(Object.assign({}, cfg), { [key]: [...ensureArray(cfg[key]), value] }) : Object.assign(Object.assign({}, cfg), { [key]: value });
1449
+ return stdout
1450
+ .split("\n")
1451
+ .filter(line => !line.startsWith(";"))
1452
+ .map(line => line.trim())
1453
+ .map(line => line.split("=", 2))
1454
+ .reduce(npmConfigReducer, {});
1455
+ }
1456
+ async function getProxyFetchOptions(params) {
1457
+ var _a, _b, _c;
1458
+ const { npmWorkspaceRootDirPath } = params;
1459
+ const cfg = await getNmpConfig({ npmWorkspaceRootDirPath });
1460
+ const proxy = ensureSingleOrNone((_a = cfg["https-proxy"]) !== null && _a !== void 0 ? _a : cfg["proxy"]);
1461
+ const noProxy = (_b = cfg["noproxy"]) !== null && _b !== void 0 ? _b : cfg["no-proxy"];
1462
+ function maybeBoolean(arg0) {
1463
+ return typeof arg0 === "undefined" ? undefined : Boolean(arg0);
1464
+ }
1465
+ const strictSSL = maybeBoolean(ensureSingleOrNone(cfg["strict-ssl"]));
1466
+ const cert = cfg["cert"];
1467
+ const ca = ensureArray((_c = cfg["ca"]) !== null && _c !== void 0 ? _c : cfg["ca[]"]);
1468
+ const cafile = ensureSingleOrNone(cfg["cafile"]);
1469
+ if (typeof cafile !== "undefined" && cafile !== "null") {
1470
+ ca.push(...(await (async () => {
1471
+ function chunks(arr, size = 2) {
1472
+ return arr
1473
+ .map((_, i) => i % size == 0 && arr.slice(i, i + size))
1474
+ .filter(Boolean);
1475
+ }
1476
+ const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
1477
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
1478
+ return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
1479
+ .join("")
1480
+ .replace(/\r?\n/g, newLinePlaceholder)
1481
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
1482
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
1483
+ })()));
1484
+ }
1485
+ return {
1486
+ proxy,
1487
+ noProxy,
1488
+ strictSSL,
1489
+ cert,
1490
+ ca: ca.length === 0 ? undefined : ca
1491
+ };
1492
+ }
1493
+ //# sourceMappingURL=fetchProxyOptions.js.map
1494
+ // EXTERNAL MODULE: external "crypto"
1495
+ var external_crypto_ = __webpack_require__(6113);
1496
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.rm.js
1497
+ var fs_rm = __webpack_require__(8699);
1498
+ ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.js
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+ async function downloadAndExtractArchive(params) {
1509
+ var _a;
1510
+ const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, npmWorkspaceRootDirPath } = params;
1511
+ const archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
1512
+ const archiveFilePath = (0,external_path_.join)(cacheDirPath, archiveFileBasename);
1513
+ download: {
1514
+ if (await (0,fs_existsAsync/* existsAsync */.o)(archiveFilePath)) {
1515
+ const isDownloaded = await SuccessTracker.getIsDownloaded({
1516
+ cacheDirPath,
1517
+ archiveFileBasename
1518
+ });
1519
+ if (isDownloaded) {
1520
+ break download;
1521
+ }
1522
+ await (0,promises_.unlink)(archiveFilePath);
1523
+ await SuccessTracker.removeFromDownloaded({
1524
+ cacheDirPath,
1525
+ archiveFileBasename
1526
+ });
1527
+ }
1528
+ await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
1529
+ const response = await lib_default()(url, await getProxyFetchOptions({ npmWorkspaceRootDirPath }));
1530
+ (_a = response.body) === null || _a === void 0 ? void 0 : _a.setMaxListeners(Number.MAX_VALUE);
1531
+ (0,assert.assert)(typeof response.body !== "undefined" && response.body != null);
1532
+ await (0,promises_.writeFile)(archiveFilePath, response.body);
1533
+ await SuccessTracker.markAsDownloaded({
1534
+ cacheDirPath,
1535
+ archiveFileBasename
1536
+ });
1537
+ }
1538
+ const extractDirBasename = `${archiveFileBasename.split(".")[0]}_${uniqueIdOfOnOnArchiveFile}_${external_crypto_.createHash("sha256")
1539
+ .update(onArchiveFile.toString())
1540
+ .digest("hex")
1541
+ .substring(0, 5)}`;
1542
+ await Promise.all((await (0,promises_.readdir)(cacheDirPath))
1543
+ .filter((() => {
1544
+ const prefix = extractDirBasename
1545
+ .split("_")
1546
+ .reverse()
1547
+ .slice(1)
1548
+ .reverse()
1549
+ .join("_");
1550
+ return basename => basename !== extractDirBasename && basename.startsWith(prefix);
1551
+ })())
1552
+ .map(async (extractDirBasename) => {
1553
+ await (0,fs_rm.rm)((0,external_path_.join)(cacheDirPath, extractDirBasename), { recursive: true });
1554
+ await SuccessTracker.removeFromExtracted({
1555
+ cacheDirPath,
1556
+ extractDirBasename
1557
+ });
1558
+ }));
1559
+ const extractedDirPath = (0,external_path_.join)(cacheDirPath, extractDirBasename);
1560
+ extract_and_transform: {
1561
+ if (await (0,fs_existsAsync/* existsAsync */.o)(extractedDirPath)) {
1562
+ const isExtracted = await SuccessTracker.getIsExtracted({
1563
+ cacheDirPath,
1564
+ extractDirBasename
1565
+ });
1566
+ if (isExtracted) {
1567
+ break extract_and_transform;
1568
+ }
1569
+ await (0,fs_rm.rm)(extractedDirPath, { recursive: true });
1570
+ await SuccessTracker.removeFromExtracted({
1571
+ cacheDirPath,
1572
+ extractDirBasename
1573
+ });
1574
+ }
1575
+ await (0,extractArchive/* extractArchive */.N)({
1576
+ archiveFilePath,
1577
+ onArchiveFile: async ({ relativeFilePathInArchive, readFile, writeFile }) => onArchiveFile({
1578
+ fileRelativePath: relativeFilePathInArchive,
1579
+ readFile,
1580
+ writeFile: ({ fileRelativePath, modifiedData }) => writeFile({
1581
+ filePath: (0,external_path_.join)(extractedDirPath, fileRelativePath),
1582
+ modifiedData
1583
+ })
1584
+ })
1585
+ });
1586
+ await SuccessTracker.markAsExtracted({
1587
+ cacheDirPath,
1588
+ extractDirBasename
1589
+ });
1590
+ }
1591
+ return { extractedDirPath };
1592
+ }
1593
+ var SuccessTracker;
1594
+ (function (SuccessTracker) {
1595
+ async function read(params) {
1596
+ const { cacheDirPath } = params;
1597
+ const filePath = (0,external_path_.join)(cacheDirPath, "downloadAndExtractArchive.json");
1598
+ if (!(await (0,fs_existsAsync/* existsAsync */.o)(filePath))) {
1599
+ return { archiveFileBasenames: [], extractDirBasenames: [] };
1600
+ }
1601
+ return JSON.parse((await (0,promises_.readFile)(filePath)).toString("utf8"));
1602
+ }
1603
+ async function write(params) {
1604
+ const { cacheDirPath, successTracker } = params;
1605
+ const filePath = (0,external_path_.join)(cacheDirPath, "downloadAndExtractArchive.json");
1606
+ {
1607
+ const dirPath = (0,external_path_.dirname)(filePath);
1608
+ if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
1609
+ await (0,promises_.mkdir)(dirPath, { recursive: true });
1610
+ }
1611
+ }
1612
+ await (0,promises_.writeFile)(filePath, JSON.stringify(successTracker));
1613
+ }
1614
+ async function markAsDownloaded(params) {
1615
+ const { cacheDirPath, archiveFileBasename } = params;
1616
+ const successTracker = await read({ cacheDirPath });
1617
+ successTracker.archiveFileBasenames.push(archiveFileBasename);
1618
+ await write({ cacheDirPath, successTracker });
1619
+ }
1620
+ SuccessTracker.markAsDownloaded = markAsDownloaded;
1621
+ async function getIsDownloaded(params) {
1622
+ const { cacheDirPath, archiveFileBasename } = params;
1623
+ const successTracker = await read({ cacheDirPath });
1624
+ return successTracker.archiveFileBasenames.includes(archiveFileBasename);
1625
+ }
1626
+ SuccessTracker.getIsDownloaded = getIsDownloaded;
1627
+ async function removeFromDownloaded(params) {
1628
+ const { cacheDirPath, archiveFileBasename } = params;
1629
+ const successTracker = await read({ cacheDirPath });
1630
+ successTracker.archiveFileBasenames = successTracker.archiveFileBasenames.filter(basename => basename !== archiveFileBasename);
1631
+ await write({ cacheDirPath, successTracker });
1632
+ }
1633
+ SuccessTracker.removeFromDownloaded = removeFromDownloaded;
1634
+ async function markAsExtracted(params) {
1635
+ const { cacheDirPath, extractDirBasename } = params;
1636
+ const successTracker = await read({ cacheDirPath });
1637
+ successTracker.extractDirBasenames.push(extractDirBasename);
1638
+ await write({ cacheDirPath, successTracker });
1639
+ }
1640
+ SuccessTracker.markAsExtracted = markAsExtracted;
1641
+ async function getIsExtracted(params) {
1642
+ const { cacheDirPath, extractDirBasename } = params;
1643
+ const successTracker = await read({ cacheDirPath });
1644
+ return successTracker.extractDirBasenames.includes(extractDirBasename);
1645
+ }
1646
+ SuccessTracker.getIsExtracted = getIsExtracted;
1647
+ async function removeFromExtracted(params) {
1648
+ const { cacheDirPath, extractDirBasename } = params;
1649
+ const successTracker = await read({ cacheDirPath });
1650
+ successTracker.extractDirBasenames = successTracker.extractDirBasenames.filter(basename => basename !== extractDirBasename);
1651
+ await write({ cacheDirPath, successTracker });
1652
+ }
1653
+ SuccessTracker.removeFromExtracted = removeFromExtracted;
1654
+ })(SuccessTracker || (SuccessTracker = {}));
1655
+ //# sourceMappingURL=downloadAndExtractArchive.js.map
1656
+ ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
1657
+
1658
+ //# sourceMappingURL=index.js.map
1659
+ // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
1660
+ var isInside = __webpack_require__(90665);
1661
+ ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+ (0,assert.assert)();
1668
+ async function downloadKeycloakDefaultTheme(params) {
1669
+ const { keycloakVersion, buildContext } = params;
1670
+ const { extractedDirPath } = await downloadAndExtractArchive({
1671
+ url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
1672
+ cacheDirPath: buildContext.cacheDirPath,
1673
+ npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
1674
+ uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
1675
+ onArchiveFile: async (params) => {
1676
+ if (!(0,isInside/* isInside */.V)({ dirPath: "theme", filePath: params.fileRelativePath })) {
1677
+ return;
1678
+ }
1679
+ const { readFile, writeFile } = params;
1680
+ const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
1681
+ skip_keycloak_v2: {
1682
+ if (!(0,isInside/* isInside */.V)({
1683
+ dirPath: (0,external_path_.join)("keycloak.v2"),
1684
+ filePath: fileRelativePath
1685
+ })) {
1686
+ break skip_keycloak_v2;
1687
+ }
1688
+ return;
1689
+ }
1690
+ last_account_v1_transformations: {
1691
+ if (constants/* lastKeycloakVersionWithAccountV1 */.v$ !== keycloakVersion) {
1692
+ break last_account_v1_transformations;
1693
+ }
1694
+ patch_account_css: {
1695
+ if (fileRelativePath !==
1696
+ (0,external_path_.join)("keycloak", "account", "resources", "css", "account.css")) {
1697
+ break patch_account_css;
1698
+ }
1699
+ await writeFile({
1700
+ fileRelativePath,
1701
+ modifiedData: Buffer.from((await readFile())
1702
+ .toString("utf8")
1703
+ .replace("top: -34px;", "top: -34px !important;"), "utf8")
1704
+ });
1705
+ return;
1706
+ }
1707
+ skip_web_modules: {
1708
+ if (!(0,isInside/* isInside */.V)({
1709
+ dirPath: (0,external_path_.join)("keycloak", "common", "resources", "web_modules"),
1710
+ filePath: fileRelativePath
1711
+ })) {
1712
+ break skip_web_modules;
1713
+ }
1714
+ return;
1715
+ }
1716
+ skip_unused_node_modules: {
1717
+ const nodeModulesDirPath = (0,external_path_.join)("keycloak", "common", "resources", "node_modules");
1718
+ if (!(0,isInside/* isInside */.V)({
1719
+ dirPath: nodeModulesDirPath,
1720
+ filePath: fileRelativePath
1721
+ })) {
1722
+ break skip_unused_node_modules;
1723
+ }
1724
+ const toKeepPrefixes = [
1725
+ ...[
1726
+ "patternfly.min.css",
1727
+ "patternfly-additions.min.css",
1728
+ "patternfly-additions.min.css"
1729
+ ].map(fileBasename => (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "css", fileBasename)),
1730
+ (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "fonts")
1731
+ ];
1732
+ if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
1733
+ break skip_unused_node_modules;
1734
+ }
1735
+ return;
1736
+ }
1737
+ }
1738
+ skip_unused_resources: {
1739
+ if (keycloakVersion !== "24.0.4") {
1740
+ break skip_unused_resources;
1741
+ }
1742
+ for (const dirBasename of [
1743
+ "@patternfly-v5",
1744
+ "@rollup",
1745
+ "rollup",
1746
+ "react",
1747
+ "react-dom",
1748
+ "shx",
1749
+ ".pnpm"
1750
+ ]) {
1751
+ if ((0,isInside/* isInside */.V)({
1752
+ dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", dirBasename),
1753
+ filePath: fileRelativePath
1754
+ })) {
1755
+ return;
1756
+ }
1757
+ }
1758
+ for (const dirBasename of ["react", "react-dom"]) {
1759
+ if ((0,isInside/* isInside */.V)({
1760
+ dirPath: (0,external_path_.join)("keycloak", "common", "resources", "vendor", dirBasename),
1761
+ filePath: fileRelativePath
1762
+ })) {
1763
+ return;
1764
+ }
1765
+ }
1766
+ if ((0,isInside/* isInside */.V)({
1767
+ dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", "@patternfly", "react-core"),
1768
+ filePath: fileRelativePath
1769
+ })) {
1770
+ return;
1771
+ }
1772
+ }
1773
+ await writeFile({ fileRelativePath });
1774
+ }
1775
+ });
1776
+ return { defaultThemeDirPath: extractedDirPath };
1777
+ }
1778
+ //# sourceMappingURL=downloadKeycloakDefaultTheme.js.map
1779
+
1780
+ /***/ }),
1781
+
1782
+ /***/ 62190:
1783
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1784
+
1785
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1786
+ /* harmony export */ "p": () => (/* binding */ downloadKeycloakStaticResources)
1787
+ /* harmony export */ });
1788
+ /* harmony import */ var _tools_transformCodebase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60332);
1789
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
1790
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1791
+ /* harmony import */ var _downloadKeycloakDefaultTheme__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(47802);
1792
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(173);
1793
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88078);
1794
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(tsafe_assert__WEBPACK_IMPORTED_MODULE_4__);
1795
+ /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(43765);
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1802
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_4__.assert)();
1803
+ async function downloadKeycloakStaticResources(params) {
1804
+ const { themeType, themeDirPath, keycloakVersion, buildContext } = params;
1805
+ const { defaultThemeDirPath } = await (0,_downloadKeycloakDefaultTheme__WEBPACK_IMPORTED_MODULE_2__/* .downloadKeycloakDefaultTheme */ .x)({
1806
+ keycloakVersion,
1807
+ buildContext
1808
+ });
1809
+ const resourcesDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(themeDirPath, themeType, "resources");
1810
+ repatriate_base_resources: {
1811
+ const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(defaultThemeDirPath, "base", themeType, "resources");
1812
+ if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_5__/* .existsAsync */ .o)(srcDirPath))) {
1813
+ break repatriate_base_resources;
1814
+ }
1815
+ (0,_tools_transformCodebase__WEBPACK_IMPORTED_MODULE_0__/* .transformCodebase */ .N)({
1816
+ srcDirPath,
1817
+ destDirPath: resourcesDirPath
1818
+ });
1819
+ }
1820
+ (0,_tools_transformCodebase__WEBPACK_IMPORTED_MODULE_0__/* .transformCodebase */ .N)({
1821
+ srcDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(defaultThemeDirPath, "keycloak", themeType, "resources"),
1822
+ destDirPath: resourcesDirPath
1823
+ });
1824
+ (0,_tools_transformCodebase__WEBPACK_IMPORTED_MODULE_0__/* .transformCodebase */ .N)({
1825
+ srcDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(defaultThemeDirPath, "keycloak", "common", "resources"),
1826
+ destDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(resourcesDirPath, _constants__WEBPACK_IMPORTED_MODULE_3__/* .resources_common */ .z0)
1827
+ });
1828
+ }
1829
+ //# sourceMappingURL=downloadKeycloakStaticResources.js.map
1830
+
1831
+ /***/ }),
1832
+
1833
+ /***/ 64409:
1834
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1835
+
1836
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1837
+ /* harmony export */ "C": () => (/* binding */ getImplementedThemeTypes)
1838
+ /* harmony export */ });
1839
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1840
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1841
+ /* harmony import */ var tsafe_objectFromEntries__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(68634);
1842
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57147);
1843
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
1844
+ /* harmony import */ var _getThemeSrcDirPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39216);
1845
+
1846
+
1847
+
1848
+
1849
+ function getImplementedThemeTypes(params) {
1850
+ const { projectDirPath } = params;
1851
+ const { themeSrcDirPath } = (0,_getThemeSrcDirPath__WEBPACK_IMPORTED_MODULE_3__/* .getThemeSrcDirPath */ .f)({
1852
+ projectDirPath
1853
+ });
1854
+ const implementedThemeTypes = (0,tsafe_objectFromEntries__WEBPACK_IMPORTED_MODULE_1__.objectFromEntries)(["login", "account", "email"].map(themeType => [
1855
+ themeType,
1856
+ fs__WEBPACK_IMPORTED_MODULE_2__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_0__.join)(themeSrcDirPath, themeType))
1857
+ ]));
1858
+ return { implementedThemeTypes };
1859
+ }
1860
+ //# sourceMappingURL=getImplementedThemeTypes.js.map
1861
+
1862
+ /***/ }),
1863
+
1372
1864
  /***/ 2323:
1373
1865
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1374
1866
 
@@ -1398,111 +1890,56 @@ function getJarFileBasename(params) {
1398
1890
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71017);
1399
1891
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
1400
1892
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(173);
1893
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78818);
1894
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_5__);
1401
1895
 
1402
1896
 
1403
1897
 
1404
1898
 
1405
1899
 
1406
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
1900
+
1901
+ let cache = undefined;
1407
1902
  /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
1408
1903
  function getThemeSrcDirPath(params) {
1409
1904
  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) {
1905
+ if (cache !== undefined && cache.projectDirPath === projectDirPath) {
1906
+ const { themeSrcDirPath } = cache;
1426
1907
  return { themeSrcDirPath };
1427
1908
  }
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();
1909
+ cache = undefined;
1910
+ const { themeSrcDirPath } = (() => {
1911
+ const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(projectDirPath, "src");
1912
+ const themeSrcDirPath = (0,_tools_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
1913
+ dirPath: srcDirPath,
1914
+ returnedPathsType: "relative to dirPath"
1915
+ })
1916
+ .map(fileRelativePath => {
1917
+ for (const themeSrcDirBasename of themeSrcDirBasenames) {
1918
+ const split = fileRelativePath.split(themeSrcDirBasename);
1919
+ if (split.length === 2) {
1920
+ return (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, split[0] + themeSrcDirBasename);
1921
+ }
1486
1922
  }
1923
+ return undefined;
1924
+ })
1925
+ .filter((0,tsafe__WEBPACK_IMPORTED_MODULE_1__.exclude)(undefined))[0];
1926
+ if (themeSrcDirPath !== undefined) {
1927
+ return { themeSrcDirPath };
1487
1928
  }
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 });
1929
+ for (const themeType of [..._constants__WEBPACK_IMPORTED_MODULE_4__/* .themeTypes */ .rO, "email"]) {
1930
+ if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, themeType))) {
1931
+ continue;
1932
+ }
1933
+ return { themeSrcDirPath: srcDirPath };
1501
1934
  }
1502
- }
1503
- fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(metaInfKeycloakThemesJsonPath, Buffer.from(JSON.stringify(metaInfKeycloakThemes, null, 2), "utf8"));
1935
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_5___default().red("Can't locate your theme source directory. It should be either: "));
1936
+ process.exit(-1);
1937
+ })();
1938
+ cache = { projectDirPath, themeSrcDirPath };
1939
+ return { themeSrcDirPath };
1504
1940
  }
1505
- //# sourceMappingURL=metaInfKeycloakThemes.js.map
1941
+ const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
1942
+ //# sourceMappingURL=getThemeSrcDirPath.js.map
1506
1943
 
1507
1944
  /***/ }),
1508
1945
 
@@ -1577,6 +2014,117 @@ function escapeStringForPropertiesFile(str) {
1577
2014
  }
1578
2015
  //# sourceMappingURL=escapeStringForPropertiesFile.js.map
1579
2016
 
2017
+ /***/ }),
2018
+
2019
+ /***/ 89693:
2020
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2021
+
2022
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2023
+ /* harmony export */ "a": () => (/* binding */ rmSync)
2024
+ /* harmony export */ });
2025
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
2026
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
2027
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
2028
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
2029
+ /* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
2030
+
2031
+
2032
+
2033
+ /**
2034
+ * Polyfill of fs.rmSync(dirPath, { "recursive": true })
2035
+ * For older version of Node
2036
+ */
2037
+ function rmSync(dirPath, options) {
2038
+ if (_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.compare */ .h.compare(_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse(process.version), _SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse("14.14.0")) > 0) {
2039
+ fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
2040
+ return;
2041
+ }
2042
+ const { force = true } = options;
2043
+ if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
2044
+ return;
2045
+ }
2046
+ const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
2047
+ const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
2048
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
2049
+ removeDir_rec(fileOrDirPath);
2050
+ return;
2051
+ }
2052
+ else {
2053
+ fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
2054
+ }
2055
+ });
2056
+ removeDir_rec(dirPath);
2057
+ }
2058
+ //# sourceMappingURL=fs.rmSync.js.map
2059
+
2060
+ /***/ }),
2061
+
2062
+ /***/ 60332:
2063
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2064
+
2065
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2066
+ /* harmony export */ "N": () => (/* binding */ transformCodebase)
2067
+ /* harmony export */ });
2068
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
2069
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
2070
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
2071
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
2072
+ /* harmony import */ var _crawl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73036);
2073
+ /* harmony import */ var _tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(89693);
2074
+
2075
+
2076
+
2077
+
2078
+ /**
2079
+ * Apply a transformation function to every file of directory
2080
+ * If source and destination are the same this function can be used to apply the transformation in place
2081
+ * like filtering out some files or modifying them.
2082
+ * */
2083
+ function transformCodebase(params) {
2084
+ const { srcDirPath, transformSourceCode } = params;
2085
+ const isTargetSameAsSource = path__WEBPACK_IMPORTED_MODULE_1__.relative(srcDirPath, params.destDirPath) === "";
2086
+ const destDirPath = isTargetSameAsSource
2087
+ ? path__WEBPACK_IMPORTED_MODULE_1__.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
2088
+ : params.destDirPath;
2089
+ fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(destDirPath, {
2090
+ recursive: true
2091
+ });
2092
+ for (const fileRelativePath of (0,_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
2093
+ dirPath: srcDirPath,
2094
+ returnedPathsType: "relative to dirPath"
2095
+ })) {
2096
+ const filePath = path__WEBPACK_IMPORTED_MODULE_1__.join(srcDirPath, fileRelativePath);
2097
+ const destFilePath = path__WEBPACK_IMPORTED_MODULE_1__.join(destDirPath, fileRelativePath);
2098
+ // NOTE: Optimization, if we don't need to transform the file, just copy
2099
+ // it using the lower level implementation.
2100
+ if (transformSourceCode === undefined) {
2101
+ fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), {
2102
+ recursive: true
2103
+ });
2104
+ fs__WEBPACK_IMPORTED_MODULE_0__.copyFileSync(filePath, destFilePath);
2105
+ continue;
2106
+ }
2107
+ const transformSourceCodeResult = transformSourceCode({
2108
+ sourceCode: fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath),
2109
+ filePath,
2110
+ fileRelativePath
2111
+ });
2112
+ if (transformSourceCodeResult === undefined) {
2113
+ continue;
2114
+ }
2115
+ fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), {
2116
+ recursive: true
2117
+ });
2118
+ const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
2119
+ fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(path__WEBPACK_IMPORTED_MODULE_1__.join(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : path__WEBPACK_IMPORTED_MODULE_1__.basename(destFilePath)), modifiedSourceCode);
2120
+ }
2121
+ if (isTargetSameAsSource) {
2122
+ (0,_tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_3__/* .rmSync */ .a)(srcDirPath, { recursive: true });
2123
+ fs__WEBPACK_IMPORTED_MODULE_0__.renameSync(destDirPath, srcDirPath);
2124
+ }
2125
+ }
2126
+ //# sourceMappingURL=transformCodebase.js.map
2127
+
1580
2128
  /***/ })
1581
2129
 
1582
2130
  };