keycloakify 10.0.0-rc.43 → 10.0.0-rc.45

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 (33) hide show
  1. package/bin/{322.index.js → 190.index.js} +58 -61
  2. package/bin/193.index.js +0 -51
  3. package/bin/3.index.js +83 -94
  4. package/bin/526.index.js +76 -48
  5. package/bin/538.index.js +7 -4
  6. package/bin/932.index.js +535 -1
  7. package/bin/98.index.js +5 -3
  8. package/bin/{944.index.js → 991.index.js} +74 -5
  9. package/bin/main.js +4 -16
  10. package/bin/shared/buildContext.d.ts +1 -1
  11. package/bin/shared/constants.d.ts +1 -1
  12. package/bin/shared/constants.js +1 -1
  13. package/bin/shared/constants.js.map +1 -1
  14. package/package.json +3 -6
  15. package/src/bin/keycloakify/buildJars/buildJar.ts +9 -21
  16. package/src/bin/keycloakify/buildJars/buildJars.ts +15 -4
  17. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +6 -7
  18. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +11 -3
  19. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +6 -18
  20. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +9 -15
  21. package/src/bin/keycloakify/keycloakify.ts +20 -9
  22. package/src/bin/main.ts +0 -14
  23. package/src/bin/shared/buildContext.ts +7 -3
  24. package/src/bin/shared/constants.ts +1 -1
  25. package/src/bin/shared/generateKcGenTs.ts +2 -1
  26. package/src/bin/shared/metaInfKeycloakThemes.ts +37 -14
  27. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  28. package/src/bin/start-keycloak/start-keycloak.ts +57 -66
  29. package/src/vite-plugin/vite-plugin.ts +5 -1
  30. package/vite-plugin/index.js +8 -4
  31. package/bin/961.index.js +0 -263
  32. package/src/bin/download-keycloak-default-theme.ts +0 -63
  33. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +0 -74
package/bin/526.index.js CHANGED
@@ -22,31 +22,53 @@ function getJarFileBasename(params) {
22
22
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23
23
 
24
24
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25
- /* harmony export */ "As": () => (/* binding */ readMetaInfKeycloakThemes),
25
+ /* harmony export */ "IS": () => (/* binding */ readMetaInfKeycloakThemes_fromJar),
26
26
  /* harmony export */ "JJ": () => (/* binding */ writeMetaInfKeycloakThemes),
27
+ /* harmony export */ "Ju": () => (/* binding */ readMetaInfKeycloakThemes_fromResourcesDirPath),
27
28
  /* harmony export */ "KQ": () => (/* binding */ getMetaInfKeycloakThemesJsonFilePath)
28
29
  /* harmony export */ });
29
30
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
30
31
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
31
32
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57147);
32
33
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
34
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88078);
35
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(tsafe_assert__WEBPACK_IMPORTED_MODULE_2__);
36
+ /* harmony import */ var _tools_extractArchive__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29121);
37
+
38
+
33
39
 
34
40
 
35
41
  function getMetaInfKeycloakThemesJsonFilePath(params) {
36
- const { keycloakifyBuildDirPath } = params;
37
- return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(keycloakifyBuildDirPath === "." ? "" : keycloakifyBuildDirPath, "src", "main", "resources", "META-INF", "keycloak-themes.json");
42
+ const { resourcesDirPath } = params;
43
+ return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(resourcesDirPath === "." ? "" : resourcesDirPath, "META-INF", "keycloak-themes.json");
38
44
  }
39
- function readMetaInfKeycloakThemes(params) {
40
- const { keycloakifyBuildDirPath } = params;
45
+ function readMetaInfKeycloakThemes_fromResourcesDirPath(params) {
46
+ const { resourcesDirPath } = params;
41
47
  return JSON.parse(fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(getMetaInfKeycloakThemesJsonFilePath({
42
- keycloakifyBuildDirPath
48
+ resourcesDirPath
43
49
  }))
44
50
  .toString("utf8"));
45
51
  }
52
+ async function readMetaInfKeycloakThemes_fromJar(params) {
53
+ const { jarFilePath } = params;
54
+ let metaInfKeycloakThemes = undefined;
55
+ await (0,_tools_extractArchive__WEBPACK_IMPORTED_MODULE_3__/* .extractArchive */ .N)({
56
+ archiveFilePath: jarFilePath,
57
+ onArchiveFile: async ({ relativeFilePathInArchive, readFile, earlyExit }) => {
58
+ if (relativeFilePathInArchive ===
59
+ getMetaInfKeycloakThemesJsonFilePath({ resourcesDirPath: "." })) {
60
+ metaInfKeycloakThemes = JSON.parse((await readFile()).toString("utf8"));
61
+ earlyExit();
62
+ }
63
+ }
64
+ });
65
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__.assert)(metaInfKeycloakThemes !== undefined);
66
+ return metaInfKeycloakThemes;
67
+ }
46
68
  function writeMetaInfKeycloakThemes(params) {
47
- const { keycloakifyBuildDirPath, metaInfKeycloakThemes } = params;
69
+ const { resourcesDirPath, metaInfKeycloakThemes } = params;
48
70
  const metaInfKeycloakThemesJsonPath = getMetaInfKeycloakThemesJsonFilePath({
49
- keycloakifyBuildDirPath
71
+ resourcesDirPath
50
72
  });
51
73
  {
52
74
  const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(metaInfKeycloakThemesJsonPath);
@@ -409,11 +431,11 @@ async function appBuild(params) {
409
431
 
410
432
  (0,assert.assert)();
411
433
  async function keycloakifyBuild(params) {
412
- const { buildContext, doSkipBuildJars } = params;
434
+ const { buildContext, onlyBuildJarFileBasename } = params;
413
435
  const dResult = new Deferred.Deferred();
414
436
  const child = external_child_process_.spawn("npx", ["keycloakify", "build"], {
415
437
  cwd: buildContext.projectDirPath,
416
- env: Object.assign(Object.assign({}, process.env), (doSkipBuildJars ? { [constants/* skipBuildJarsEnvName */.uo]: "true" } : {}))
438
+ env: Object.assign(Object.assign({}, process.env), { [constants/* onlyBuildJarFileBasenameEnvName */.Dv]: onlyBuildJarFileBasename })
417
439
  });
418
440
  child.stdout.on("data", data => process.stdout.write(data));
419
441
  child.stderr.on("data", data => process.stderr.write(data));
@@ -422,6 +444,12 @@ async function keycloakifyBuild(params) {
422
444
  return { isKeycloakifyBuildSuccess: isSuccess };
423
445
  }
424
446
  //# sourceMappingURL=keycloakifyBuild.js.map
447
+ // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
448
+ var isInside = __webpack_require__(90665);
449
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
450
+ var fs_existsAsync = __webpack_require__(43765);
451
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.rm.js
452
+ var fs_rm = __webpack_require__(8699);
425
453
  ;// CONCATENATED MODULE: ./dist/bin/start-keycloak/start-keycloak.js
426
454
 
427
455
 
@@ -440,6 +468,9 @@ async function keycloakifyBuild(params) {
440
468
 
441
469
 
442
470
 
471
+
472
+
473
+
443
474
 
444
475
 
445
476
 
@@ -492,7 +523,7 @@ async function command(params) {
492
523
  process.exit(1);
493
524
  }
494
525
  const { isKeycloakifyBuildSuccess } = await keycloakifyBuild({
495
- doSkipBuildJars: false,
526
+ onlyBuildJarFileBasename: undefined,
496
527
  buildContext
497
528
  });
498
529
  if (!isKeycloakifyBuildSuccess) {
@@ -500,10 +531,20 @@ async function command(params) {
500
531
  process.exit(1);
501
532
  }
502
533
  }
503
- const metaInfKeycloakThemes = (0,shared_metaInfKeycloakThemes/* readMetaInfKeycloakThemes */.As)({
504
- keycloakifyBuildDirPath: buildContext.keycloakifyBuildDirPath
505
- });
506
- const doesImplementAccountTheme = metaInfKeycloakThemes.themes.some(({ name }) => name === constants/* accountV1ThemeName */.y_);
534
+ const { doesImplementAccountTheme } = await (async () => {
535
+ const latestJarFilePath = external_fs_.readdirSync(buildContext.keycloakifyBuildDirPath)
536
+ .filter(fileBasename => fileBasename.endsWith(".jar"))
537
+ .map(fileBasename => (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, fileBasename))
538
+ .sort((a, b) => external_fs_.statSync(b).mtimeMs - external_fs_.statSync(a).mtimeMs)[0];
539
+ (0,assert.assert)(latestJarFilePath !== undefined);
540
+ const metaInfKeycloakThemes = await (0,shared_metaInfKeycloakThemes/* readMetaInfKeycloakThemes_fromJar */.IS)({
541
+ jarFilePath: latestJarFilePath
542
+ });
543
+ const mainThemeEntry = metaInfKeycloakThemes.themes.find(({ name }) => name === buildContext.themeNames[0]);
544
+ (0,assert.assert)(mainThemeEntry !== undefined);
545
+ const doesImplementAccountTheme = mainThemeEntry.types.includes("account");
546
+ return { doesImplementAccountTheme };
547
+ })();
507
548
  const { keycloakVersion, keycloakMajorNumber: keycloakMajorVersionNumber } = await (async function getKeycloakMajor() {
508
549
  if (cliCommandOptions.keycloakVersion !== undefined) {
509
550
  return {
@@ -586,40 +627,25 @@ async function command(params) {
586
627
  return (0,external_path_.join)(dirPath, value);
587
628
  })();
588
629
  const jarFilePath = (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, jarFileBasename);
589
- const { doUseBuiltInAccountV1Theme } = await (async () => {
590
- let doUseBuiltInAccountV1Theme = false;
630
+ async function extractThemeResourcesFromJar() {
591
631
  await (0,extractArchive/* extractArchive */.N)({
592
632
  archiveFilePath: jarFilePath,
593
- onArchiveFile: async ({ relativeFilePathInArchive, readFile, earlyExit }) => {
594
- for (const themeName of buildContext.themeNames) {
595
- if (relativeFilePathInArchive ===
596
- (0,external_path_.join)("theme", themeName, "account", "theme.properties")) {
597
- if ((await readFile())
598
- .toString("utf8")
599
- .includes("parent=keycloak")) {
600
- doUseBuiltInAccountV1Theme = true;
601
- }
602
- earlyExit();
603
- }
633
+ onArchiveFile: async ({ relativeFilePathInArchive, writeFile }) => {
634
+ if ((0,isInside/* isInside */.V)({ dirPath: "theme", filePath: relativeFilePathInArchive })) {
635
+ await writeFile({
636
+ filePath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, relativeFilePathInArchive)
637
+ });
604
638
  }
605
639
  }
606
640
  });
607
- return { doUseBuiltInAccountV1Theme };
608
- })();
609
- const accountThemePropertyPatch = !doUseBuiltInAccountV1Theme
610
- ? undefined
611
- : () => {
612
- for (const themeName of buildContext.themeNames) {
613
- const filePath = (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName, "account", "theme.properties");
614
- const sourceCode = external_fs_.readFileSync(filePath);
615
- const modifiedSourceCode = Buffer.from(sourceCode
616
- .toString("utf8")
617
- .replace(`parent=${constants/* accountV1ThemeName */.y_}`, "parent=keycloak"), "utf8");
618
- (0,assert.assert)(Buffer.compare(modifiedSourceCode, sourceCode) !== 0);
619
- external_fs_.writeFileSync(filePath, modifiedSourceCode);
620
- }
621
- };
622
- accountThemePropertyPatch === null || accountThemePropertyPatch === void 0 ? void 0 : accountThemePropertyPatch();
641
+ }
642
+ {
643
+ const destDirPath = (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme");
644
+ if (await (0,fs_existsAsync/* existsAsync */.o)(destDirPath)) {
645
+ await (0,fs_rm.rm)(destDirPath, { recursive: true });
646
+ }
647
+ }
648
+ await extractThemeResourcesFromJar();
623
649
  try {
624
650
  external_child_process_.execSync(`docker rm --force ${constants/* containerName */.h6}`, {
625
651
  stdio: "ignore"
@@ -646,10 +672,12 @@ async function command(params) {
646
672
  : []),
647
673
  ...[
648
674
  ...buildContext.themeNames,
649
- ...(doUseBuiltInAccountV1Theme ? [] : [constants/* accountV1ThemeName */.y_])
675
+ ...(external_fs_.existsSync((0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme", constants/* accountV1ThemeName */.y_))
676
+ ? [constants/* accountV1ThemeName */.y_]
677
+ : [])
650
678
  ]
651
679
  .map(themeName => ({
652
- localDirPath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName),
680
+ localDirPath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme", themeName),
653
681
  containerDirPath: `/opt/keycloak/themes/${themeName}`
654
682
  }))
655
683
  .map(({ localDirPath, containerDirPath }) => [
@@ -718,13 +746,13 @@ async function command(params) {
718
746
  return;
719
747
  }
720
748
  const { isKeycloakifyBuildSuccess } = await keycloakifyBuild({
721
- doSkipBuildJars: true,
749
+ onlyBuildJarFileBasename: jarFileBasename,
722
750
  buildContext
723
751
  });
724
752
  if (!isKeycloakifyBuildSuccess) {
725
753
  return;
726
754
  }
727
- accountThemePropertyPatch === null || accountThemePropertyPatch === void 0 ? void 0 : accountThemePropertyPatch();
755
+ await extractThemeResourcesFromJar();
728
756
  console.log(source_default().green("Theme rebuilt and updated in Keycloak."));
729
757
  });
730
758
  const { waitForDebounce } = (0,tools_waitForDebounce/* waitForDebounceFactory */.z)({ delay: 400 });
package/bin/538.index.js CHANGED
@@ -156,7 +156,9 @@ function getBuildContext(params) {
156
156
  if (typeof buildOptions.themeName === "string") {
157
157
  return [buildOptions.themeName];
158
158
  }
159
- return buildOptions.themeName;
159
+ const [mainThemeName, ...themeVariantNames] = buildOptions.themeName;
160
+ (0,tsafe.assert)(mainThemeName !== undefined);
161
+ return [mainThemeName, ...themeVariantNames];
160
162
  })();
161
163
  const projectBuildDirPath = (() => {
162
164
  var _a;
@@ -285,6 +287,7 @@ function getBuildContext(params) {
285
287
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
286
288
 
287
289
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
290
+ /* harmony export */ "Dv": () => (/* binding */ onlyBuildJarFileBasenameEnvName),
288
291
  /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
289
292
  /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
290
293
  /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
@@ -294,7 +297,6 @@ function getBuildContext(params) {
294
297
  /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
295
298
  /* harmony export */ "rO": () => (/* binding */ themeTypes),
296
299
  /* harmony export */ "sj": () => (/* binding */ loginThemePageIds),
297
- /* harmony export */ "uo": () => (/* binding */ skipBuildJarsEnvName),
298
300
  /* harmony export */ "v$": () => (/* binding */ lastKeycloakVersionWithAccountV1),
299
301
  /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
300
302
  /* harmony export */ "z0": () => (/* binding */ resources_common)
@@ -311,7 +313,7 @@ const vitePluginSubScriptEnvNames = {
311
313
  runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
312
314
  resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
313
315
  };
314
- const skipBuildJarsEnvName = "KEYCLOAKIFY_SKIP_BUILD_JAR";
316
+ const onlyBuildJarFileBasenameEnvName = "KEYCLOAKIFY_ONLY_BUILD_JAR_FILE_BASENAME";
315
317
  const loginThemePageIds = [
316
318
  "login.ftl",
317
319
  "login-username.ftl",
@@ -572,7 +574,8 @@ async function generateKcGenTs(params) {
572
574
  ``,
573
575
  `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
574
576
  ``,
575
- `/* prettier-ignore-end */`
577
+ `/* prettier-ignore-end */`,
578
+ ``
576
579
  ].join("\n"), "utf8");
577
580
  if (currentContent !== undefined && currentContent.equals(newContent)) {
578
581
  return;