keycloakify 10.0.0-rc.64 → 10.0.0-rc.66

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 (49) 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/193.index.js +0 -501
  8. package/bin/246.index.js +371 -75118
  9. package/bin/363.index.js +36 -665
  10. package/bin/453.index.js +603 -23
  11. package/bin/{890.index.js → 456.index.js} +1831 -3
  12. package/bin/490.index.js +75195 -0
  13. package/bin/526.index.js +311 -166
  14. package/bin/538.index.js +1 -509
  15. package/bin/{240.index.js → 751.index.js} +306 -322
  16. package/bin/772.index.js +1 -1
  17. package/bin/837.index.js +787 -0
  18. package/bin/932.index.js +1 -574
  19. package/bin/97.index.js +594 -14
  20. package/bin/main.js +8 -8
  21. package/bin/shared/buildContext.d.ts +16 -0
  22. package/bin/shared/constants.d.ts +1 -1
  23. package/bin/shared/constants.js +1 -1
  24. package/bin/shared/constants.js.map +1 -1
  25. package/package.json +5 -9
  26. package/src/account/KcContext/KcContext.ts +1 -0
  27. package/src/account/KcContext/kcContextMocks.ts +2 -1
  28. package/src/account/pages/Totp.tsx +1 -7
  29. package/src/bin/add-story.ts +1 -6
  30. package/src/bin/eject-page.ts +7 -8
  31. package/src/bin/initialize-email-theme.ts +1 -6
  32. package/src/bin/keycloakify/buildJars/buildJars.ts +23 -49
  33. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +8 -6
  34. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +15 -20
  35. package/src/bin/keycloakify/keycloakify.ts +6 -8
  36. package/src/bin/shared/buildContext.ts +434 -42
  37. package/src/bin/shared/constants.ts +2 -1
  38. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +135 -108
  39. package/src/bin/shared/generateKcGenTs.ts +2 -6
  40. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  41. package/src/bin/start-keycloak/start-keycloak.ts +40 -83
  42. package/src/vite-plugin/vite-plugin.ts +5 -4
  43. package/vite-plugin/index.js +410 -187
  44. package/bin/480.index.js +0 -466
  45. package/bin/818.index.js +0 -1802
  46. package/bin/827.index.js +0 -1094
  47. package/src/bin/shared/getImplementedThemeTypes.ts +0 -23
  48. package/src/bin/shared/getJarFileBasename.ts +0 -11
  49. package/src/bin/shared/getThemeSrcDirPath.ts +0 -62
@@ -4049,11 +4049,43 @@ var z = /*#__PURE__*/Object.freeze({
4049
4049
 
4050
4050
 
4051
4051
 
4052
- // EXTERNAL MODULE: ./node_modules/tsafe/index.js
4053
- var tsafe = __nccwpck_require__(1666);
4054
4052
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
4055
4053
  var constants = __nccwpck_require__(173);
4054
+ // EXTERNAL MODULE: ./node_modules/tsafe/index.js
4055
+ var tsafe = __nccwpck_require__(1666);
4056
+ // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
4057
+ var crawl = __nccwpck_require__(3036);
4058
+ // EXTERNAL MODULE: ./node_modules/tsafe/objectFromEntries.js
4059
+ var objectFromEntries = __nccwpck_require__(8634);
4060
+ // EXTERNAL MODULE: ./node_modules/tsafe/objectEntries.js
4061
+ var objectEntries = __nccwpck_require__(9612);
4062
+ // EXTERNAL MODULE: ./node_modules/tsafe/id.js
4063
+ var id = __nccwpck_require__(3047);
4064
+ // EXTERNAL MODULE: ./node_modules/tsafe/symToStr.js
4065
+ var symToStr = __nccwpck_require__(6564);
4066
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
4067
+ var source = __nccwpck_require__(8818);
4068
+ var source_default = /*#__PURE__*/__nccwpck_require__.n(source);
4056
4069
  ;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
4070
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
4071
+ var t = {};
4072
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4073
+ t[p] = s[p];
4074
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
4075
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4076
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
4077
+ t[p[i]] = s[p[i]];
4078
+ }
4079
+ return t;
4080
+ };
4081
+
4082
+
4083
+
4084
+
4085
+
4086
+
4087
+
4088
+
4057
4089
 
4058
4090
 
4059
4091
 
@@ -4086,7 +4118,7 @@ function getBuildContext(params) {
4086
4118
  env: Object.assign(Object.assign({}, process.env), { [constants.vitePluginSubScriptEnvNames.resolveViteConfig]: "true" })
4087
4119
  })
4088
4120
  .toString("utf8");
4089
- (0,tsafe.assert)(output.includes(constants.vitePluginSubScriptEnvNames.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
4121
+ (0,assert.assert)(output.includes(constants.vitePluginSubScriptEnvNames.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
4090
4122
  const resolvedViteConfigStr = output
4091
4123
  .split(constants.vitePluginSubScriptEnvNames.resolveViteConfig)
4092
4124
  .reverse()[0];
@@ -4094,36 +4126,99 @@ function getBuildContext(params) {
4094
4126
  return { resolvedViteConfig };
4095
4127
  })();
4096
4128
  const parsedPackageJson = (() => {
4097
- {
4098
- (0,tsafe.assert)();
4099
- }
4100
4129
  const zParsedPackageJson = z.object({
4101
4130
  name: z.string(),
4102
4131
  version: z.string().optional(),
4103
4132
  homepage: z.string().optional(),
4104
- keycloakify: z.object({
4105
- extraThemeProperties: z.array(z.string()).optional(),
4106
- artifactId: z.string().optional(),
4107
- groupId: z.string().optional(),
4108
- loginThemeResourcesFromKeycloakVersion: z.string().optional(),
4109
- projectBuildDirPath: z.string().optional(),
4110
- keycloakifyBuildDirPath: z.string().optional(),
4111
- kcContextExclusionsFtl: z.string().optional(),
4112
- environmentVariables: z.array(z.object({
4113
- name: z.string(),
4114
- default: z.string()
4115
- }))
4116
- .optional(),
4117
- themeName: z.union([z.string(), z.array(z.string())]).optional()
4118
- })
4119
- .optional()
4133
+ keycloakify: (0,id.id)((() => {
4134
+ const zBuildOptions_packageJson = z.object({
4135
+ extraThemeProperties: z.array(z.string()).optional(),
4136
+ artifactId: z.string().optional(),
4137
+ groupId: z.string().optional(),
4138
+ loginThemeResourcesFromKeycloakVersion: z.string().optional(),
4139
+ projectBuildDirPath: z.string().optional(),
4140
+ keycloakifyBuildDirPath: z.string().optional(),
4141
+ kcContextExclusionsFtl: z.string().optional(),
4142
+ environmentVariables: z.array(z.object({
4143
+ name: z.string(),
4144
+ default: z.string()
4145
+ }))
4146
+ .optional(),
4147
+ themeName: z.union([z.string(), z.array(z.string())]).optional(),
4148
+ keycloakVersionTargets: (0,id.id)((() => {
4149
+ const zKeycloakVersionTargets = z.union([
4150
+ z.object({
4151
+ hasAccountTheme: z.literal(true),
4152
+ "21-and-below": z.union([
4153
+ z.boolean(),
4154
+ z.string()
4155
+ ]),
4156
+ "23": z.union([z.boolean(), z.string()]),
4157
+ "24": z.union([z.boolean(), z.string()]),
4158
+ "25-and-above": z.union([z.boolean(), z.string()])
4159
+ }),
4160
+ z.object({
4161
+ hasAccountTheme: z.literal(false),
4162
+ "21-and-below": z.union([
4163
+ z.boolean(),
4164
+ z.string()
4165
+ ]),
4166
+ "22-and-above": z.union([z.boolean(), z.string()])
4167
+ })
4168
+ ]);
4169
+ {
4170
+ (0,assert.assert)();
4171
+ }
4172
+ return zKeycloakVersionTargets;
4173
+ })()).optional()
4174
+ });
4175
+ {
4176
+ (0,assert.assert)();
4177
+ }
4178
+ return zBuildOptions_packageJson;
4179
+ })()).optional()
4120
4180
  });
4121
4181
  {
4122
- (0,tsafe.assert)();
4182
+ (0,assert.assert)();
4123
4183
  }
4124
4184
  return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(projectDirPath, "package.json")).toString("utf8")));
4125
4185
  })();
4126
4186
  const buildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildOptions);
4187
+ const { themeSrcDirPath } = (() => {
4188
+ const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
4189
+ const themeSrcDirPath = (0,crawl/* crawl */.J)({
4190
+ dirPath: srcDirPath,
4191
+ returnedPathsType: "relative to dirPath"
4192
+ })
4193
+ .map(fileRelativePath => {
4194
+ for (const themeSrcDirBasename of ["keycloak-theme", "keycloak_theme"]) {
4195
+ const split = fileRelativePath.split(themeSrcDirBasename);
4196
+ if (split.length === 2) {
4197
+ return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
4198
+ }
4199
+ }
4200
+ return undefined;
4201
+ })
4202
+ .filter((0,tsafe.exclude)(undefined))[0];
4203
+ if (themeSrcDirPath !== undefined) {
4204
+ return { themeSrcDirPath };
4205
+ }
4206
+ for (const themeType of [...constants.themeTypes, "email"]) {
4207
+ if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
4208
+ continue;
4209
+ }
4210
+ return { themeSrcDirPath: srcDirPath };
4211
+ }
4212
+ console.log(source_default().red([
4213
+ "Can't locate your keycloak theme source directory.",
4214
+ "See: https://docs.keycloakify.dev/v/v10/keycloakify-in-my-app/collocation"
4215
+ ].join("\n")));
4216
+ process.exit(1);
4217
+ })();
4218
+ const recordIsImplementedByThemeType = (0,objectFromEntries.objectFromEntries)(["login", "account", "email"].map(themeType => [
4219
+ themeType,
4220
+ external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, themeType))
4221
+ ]));
4127
4222
  const themeNames = (() => {
4128
4223
  if (buildOptions.themeName === undefined) {
4129
4224
  return [
@@ -4137,7 +4232,7 @@ function getBuildContext(params) {
4137
4232
  return [buildOptions.themeName];
4138
4233
  }
4139
4234
  const [mainThemeName, ...themeVariantNames] = buildOptions.themeName;
4140
- (0,tsafe.assert)(mainThemeName !== undefined);
4235
+ (0,assert.assert)(mainThemeName !== undefined);
4141
4236
  return [mainThemeName, ...themeVariantNames];
4142
4237
  })();
4143
4238
  const projectBuildDirPath = (() => {
@@ -4160,8 +4255,9 @@ function getBuildContext(params) {
4160
4255
  projectDirPath,
4161
4256
  dependencyExpected: "keycloakify"
4162
4257
  });
4258
+ const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
4163
4259
  return {
4164
- bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
4260
+ bundler,
4165
4261
  themeVersion: (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
4166
4262
  themeNames,
4167
4263
  extraThemeProperties: buildOptions.extraThemeProperties,
@@ -4256,7 +4352,187 @@ function getBuildContext(params) {
4256
4352
  }
4257
4353
  return buildOptions.kcContextExclusionsFtl;
4258
4354
  })(),
4259
- environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : []
4355
+ environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : [],
4356
+ recordIsImplementedByThemeType,
4357
+ themeSrcDirPath,
4358
+ jarTargets: (() => {
4359
+ const getDefaultJarFileBasename = (range) => `keycloak-theme-for-kc-${range}.jar`;
4360
+ build_for_specific_keycloak_major_version: {
4361
+ const buildForKeycloakMajorVersionNumber = (() => {
4362
+ const envValue = process.env[constants.buildForKeycloakMajorVersionEnvName];
4363
+ if (envValue === undefined) {
4364
+ return undefined;
4365
+ }
4366
+ const major = parseInt(envValue);
4367
+ (0,assert.assert)(!isNaN(major));
4368
+ return major;
4369
+ })();
4370
+ if (buildForKeycloakMajorVersionNumber === undefined) {
4371
+ break build_for_specific_keycloak_major_version;
4372
+ }
4373
+ const keycloakVersionRange = (() => {
4374
+ const doesImplementAccountTheme = recordIsImplementedByThemeType.account;
4375
+ if (doesImplementAccountTheme) {
4376
+ const keycloakVersionRange = (() => {
4377
+ if (buildForKeycloakMajorVersionNumber <= 21) {
4378
+ return "21-and-below";
4379
+ }
4380
+ (0,assert.assert)(buildForKeycloakMajorVersionNumber !== 22);
4381
+ if (buildForKeycloakMajorVersionNumber === 23) {
4382
+ return "23";
4383
+ }
4384
+ if (buildForKeycloakMajorVersionNumber === 24) {
4385
+ return "24";
4386
+ }
4387
+ return "25-and-above";
4388
+ })();
4389
+ (0,assert.assert)();
4390
+ return keycloakVersionRange;
4391
+ }
4392
+ else {
4393
+ const keycloakVersionRange = (() => {
4394
+ if (buildForKeycloakMajorVersionNumber <= 21) {
4395
+ return "21-and-below";
4396
+ }
4397
+ return "22-and-above";
4398
+ })();
4399
+ (0,assert.assert)();
4400
+ return keycloakVersionRange;
4401
+ }
4402
+ })();
4403
+ const jarFileBasename = (() => {
4404
+ use_custom_jar_basename: {
4405
+ const { keycloakVersionTargets } = buildOptions;
4406
+ if (keycloakVersionTargets === undefined) {
4407
+ break use_custom_jar_basename;
4408
+ }
4409
+ const entry = (0,objectEntries.objectEntries)(keycloakVersionTargets).find(([keycloakVersionRange_entry]) => keycloakVersionRange_entry === keycloakVersionRange);
4410
+ if (entry === undefined) {
4411
+ break use_custom_jar_basename;
4412
+ }
4413
+ const maybeJarFileBasename = entry[1];
4414
+ if (typeof maybeJarFileBasename !== "string") {
4415
+ break use_custom_jar_basename;
4416
+ }
4417
+ return maybeJarFileBasename;
4418
+ }
4419
+ return getDefaultJarFileBasename(keycloakVersionRange);
4420
+ })();
4421
+ return [
4422
+ {
4423
+ keycloakVersionRange,
4424
+ jarFileBasename
4425
+ }
4426
+ ];
4427
+ }
4428
+ const jarTargets_default = (() => {
4429
+ const jarTargets = [];
4430
+ if (recordIsImplementedByThemeType.account) {
4431
+ for (const keycloakVersionRange of [
4432
+ "21-and-below",
4433
+ "23",
4434
+ "24",
4435
+ "25-and-above"
4436
+ ]) {
4437
+ (0,assert.assert)(true);
4438
+ jarTargets.push({
4439
+ keycloakVersionRange,
4440
+ jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
4441
+ });
4442
+ }
4443
+ }
4444
+ else {
4445
+ for (const keycloakVersionRange of [
4446
+ "21-and-below",
4447
+ "22-and-above"
4448
+ ]) {
4449
+ (0,assert.assert)(true);
4450
+ jarTargets.push({
4451
+ keycloakVersionRange,
4452
+ jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
4453
+ });
4454
+ }
4455
+ }
4456
+ return jarTargets;
4457
+ })();
4458
+ if (buildOptions.keycloakVersionTargets === undefined) {
4459
+ return jarTargets_default;
4460
+ }
4461
+ if (buildOptions.keycloakVersionTargets.hasAccountTheme !==
4462
+ recordIsImplementedByThemeType.account) {
4463
+ console.log(source_default().red((() => {
4464
+ const { keycloakVersionTargets } = buildOptions;
4465
+ let message = `Bad ${(0,symToStr/* symToStr */.r)({ keycloakVersionTargets })} configuration.\n`;
4466
+ if (keycloakVersionTargets.hasAccountTheme) {
4467
+ message +=
4468
+ "Your codebase does not seem to implement an account theme ";
4469
+ }
4470
+ else {
4471
+ message += "Your codebase implements an account theme ";
4472
+ }
4473
+ const { hasAccountTheme } = keycloakVersionTargets;
4474
+ message += `but you have set ${(0,symToStr/* symToStr */.r)({ keycloakVersionTargets })}.${(0,symToStr/* symToStr */.r)({ hasAccountTheme })}`;
4475
+ message += ` to ${hasAccountTheme} in your `;
4476
+ message += (() => {
4477
+ switch (bundler) {
4478
+ case "vite":
4479
+ return "vite.config.ts";
4480
+ case "webpack":
4481
+ return "package.json";
4482
+ }
4483
+ (0,assert.assert)(false);
4484
+ })();
4485
+ message += `. Please set it to ${!hasAccountTheme} `;
4486
+ message +=
4487
+ "and fill up the relevant keycloak version ranges.\n";
4488
+ message += "Example:\n";
4489
+ message += JSON.stringify((0,id.id)({
4490
+ keycloakVersionTargets: Object.assign({ hasAccountTheme: recordIsImplementedByThemeType.account }, (0,objectFromEntries.objectFromEntries)(jarTargets_default.map(({ keycloakVersionRange, jarFileBasename }) => [
4491
+ keycloakVersionRange,
4492
+ jarFileBasename
4493
+ ])))
4494
+ }), null, 2);
4495
+ return message;
4496
+ })()));
4497
+ process.exit(1);
4498
+ }
4499
+ const jarTargets = [];
4500
+ const _a = buildOptions.keycloakVersionTargets, { hasAccountTheme } = _a, rest = __rest(_a, ["hasAccountTheme"]);
4501
+ for (const [keycloakVersionRange, jarNameOrBoolean] of (0,objectEntries.objectEntries)(rest)) {
4502
+ if (jarNameOrBoolean === false) {
4503
+ continue;
4504
+ }
4505
+ if (jarNameOrBoolean === true) {
4506
+ jarTargets.push({
4507
+ keycloakVersionRange: keycloakVersionRange,
4508
+ jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
4509
+ });
4510
+ continue;
4511
+ }
4512
+ const jarFileBasename = jarNameOrBoolean;
4513
+ if (!jarFileBasename.endsWith(".jar")) {
4514
+ console.log(source_default().red(`Bad ${jarFileBasename} should end with '.jar'\n`));
4515
+ process.exit(1);
4516
+ }
4517
+ if (jarFileBasename.includes("/") || jarFileBasename.includes("\\")) {
4518
+ console.log(source_default().red([
4519
+ `Invalid ${jarFileBasename}. It's not supposed to be a path,`,
4520
+ `Only the basename of the jar file is expected.`,
4521
+ `Example: keycloak-theme.jar`
4522
+ ].join(" ")));
4523
+ process.exit(1);
4524
+ }
4525
+ jarTargets.push({
4526
+ keycloakVersionRange: keycloakVersionRange,
4527
+ jarFileBasename: jarNameOrBoolean
4528
+ });
4529
+ }
4530
+ if (jarTargets.length === 0) {
4531
+ console.log(source_default().red("All jar targets are disabled. Please enable at least one jar target."));
4532
+ process.exit(1);
4533
+ }
4534
+ return jarTargets;
4535
+ })()
4260
4536
  };
4261
4537
  }
4262
4538
  //# sourceMappingURL=buildContext.js.map
@@ -4272,12 +4548,12 @@ __nccwpck_require__.r(__webpack_exports__);
4272
4548
  /* harmony export */ "accountThemePageIds": () => (/* binding */ accountThemePageIds),
4273
4549
  /* harmony export */ "accountV1ThemeName": () => (/* binding */ accountV1ThemeName),
4274
4550
  /* harmony export */ "basenameOfTheKeycloakifyResourcesDir": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
4551
+ /* harmony export */ "buildForKeycloakMajorVersionEnvName": () => (/* binding */ buildForKeycloakMajorVersionEnvName),
4275
4552
  /* harmony export */ "containerName": () => (/* binding */ containerName),
4276
4553
  /* harmony export */ "keycloak_resources": () => (/* binding */ keycloak_resources),
4277
4554
  /* harmony export */ "lastKeycloakVersionWithAccountV1": () => (/* binding */ lastKeycloakVersionWithAccountV1),
4278
4555
  /* harmony export */ "loginThemePageIds": () => (/* binding */ loginThemePageIds),
4279
4556
  /* harmony export */ "nameOfTheLocalizationRealmOverridesUserProfileProperty": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
4280
- /* harmony export */ "onlyBuildJarFileBasenameEnvName": () => (/* binding */ onlyBuildJarFileBasenameEnvName),
4281
4557
  /* harmony export */ "resources_common": () => (/* binding */ resources_common),
4282
4558
  /* harmony export */ "themeTypes": () => (/* binding */ themeTypes),
4283
4559
  /* harmony export */ "vitePluginSubScriptEnvNames": () => (/* binding */ vitePluginSubScriptEnvNames)
@@ -4293,7 +4569,7 @@ const vitePluginSubScriptEnvNames = {
4293
4569
  runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
4294
4570
  resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
4295
4571
  };
4296
- const onlyBuildJarFileBasenameEnvName = "KEYCLOAKIFY_ONLY_BUILD_JAR_FILE_BASENAME";
4572
+ const buildForKeycloakMajorVersionEnvName = "KEYCLOAKIFY_BUILD_FOR_KEYCLOAK_MAJOR_VERSION";
4297
4573
  const loginThemePageIds = [
4298
4574
  "login.ftl",
4299
4575
  "login-username.ftl",
@@ -4344,7 +4620,7 @@ const containerName = "keycloak-keycloakify";
4344
4620
 
4345
4621
  /***/ }),
4346
4622
 
4347
- /***/ 8272:
4623
+ /***/ 4901:
4348
4624
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4349
4625
 
4350
4626
  "use strict";
@@ -4807,38 +5083,29 @@ var SuccessTracker;
4807
5083
  ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
4808
5084
 
4809
5085
  //# sourceMappingURL=index.js.map
4810
- ;// CONCATENATED MODULE: ./dist/bin/tools/isInside.js
4811
-
4812
- function isInside(params) {
4813
- const { dirPath, filePath } = params;
4814
- return !(0,external_path_.relative)(dirPath, filePath).startsWith("..");
4815
- }
4816
- //# sourceMappingURL=isInside.js.map
4817
5086
  ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
4818
5087
 
4819
5088
 
4820
5089
 
4821
5090
 
4822
-
4823
5091
  (0,assert.assert)();
4824
5092
  async function downloadKeycloakDefaultTheme(params) {
4825
5093
  const { keycloakVersion, buildContext } = params;
5094
+ let kcNodeModulesKeepFilePaths = undefined;
5095
+ let kcNodeModulesKeepFilePaths_lastAccountV1 = undefined;
4826
5096
  const { extractedDirPath } = await downloadAndExtractArchive({
4827
5097
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
4828
5098
  cacheDirPath: buildContext.cacheDirPath,
4829
5099
  npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
4830
5100
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
4831
5101
  onArchiveFile: async (params) => {
4832
- if (!isInside({ dirPath: "theme", filePath: params.fileRelativePath })) {
5102
+ const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
5103
+ if (fileRelativePath.startsWith("..")) {
4833
5104
  return;
4834
5105
  }
4835
5106
  const { readFile, writeFile } = params;
4836
- const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
4837
5107
  skip_keycloak_v2: {
4838
- if (!isInside({
4839
- dirPath: (0,external_path_.join)("keycloak.v2"),
4840
- filePath: fileRelativePath
4841
- })) {
5108
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak.v2"))) {
4842
5109
  break skip_keycloak_v2;
4843
5110
  }
4844
5111
  return;
@@ -4847,6 +5114,39 @@ async function downloadKeycloakDefaultTheme(params) {
4847
5114
  if (constants.lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
4848
5115
  break last_account_v1_transformations;
4849
5116
  }
5117
+ skip_web_modules: {
5118
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "web_modules"))) {
5119
+ break skip_web_modules;
5120
+ }
5121
+ return;
5122
+ }
5123
+ skip_lib: {
5124
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "lib"))) {
5125
+ break skip_lib;
5126
+ }
5127
+ return;
5128
+ }
5129
+ skip_node_modules: {
5130
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "node_modules"))) {
5131
+ break skip_node_modules;
5132
+ }
5133
+ if (kcNodeModulesKeepFilePaths_lastAccountV1 === undefined) {
5134
+ kcNodeModulesKeepFilePaths_lastAccountV1 = [
5135
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly.min.css"),
5136
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly-additions.min.css"),
5137
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Regular-webfont.woff2"),
5138
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Bold-webfont.woff2"),
5139
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Light-webfont.woff2"),
5140
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Semibold-webfont.woff2")
5141
+ ];
5142
+ }
5143
+ for (const keepPath of kcNodeModulesKeepFilePaths_lastAccountV1) {
5144
+ if (fileRelativePath.endsWith(keepPath)) {
5145
+ break skip_node_modules;
5146
+ }
5147
+ }
5148
+ return;
5149
+ }
4850
5150
  patch_account_css: {
4851
5151
  if (fileRelativePath !==
4852
5152
  (0,external_path_.join)("keycloak", "account", "resources", "css", "account.css")) {
@@ -4860,69 +5160,44 @@ async function downloadKeycloakDefaultTheme(params) {
4860
5160
  });
4861
5161
  return;
4862
5162
  }
4863
- skip_web_modules: {
4864
- if (!isInside({
4865
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "web_modules"),
4866
- filePath: fileRelativePath
4867
- })) {
4868
- break skip_web_modules;
4869
- }
4870
- return;
4871
- }
4872
- skip_unused_node_modules: {
4873
- const nodeModulesDirPath = (0,external_path_.join)("keycloak", "common", "resources", "node_modules");
4874
- if (!isInside({
4875
- dirPath: nodeModulesDirPath,
4876
- filePath: fileRelativePath
4877
- })) {
4878
- break skip_unused_node_modules;
4879
- }
4880
- const toKeepPrefixes = [
4881
- ...[
4882
- "patternfly.min.css",
4883
- "patternfly-additions.min.css",
4884
- "patternfly-additions.min.css"
4885
- ].map(fileBasename => (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "css", fileBasename)),
4886
- (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "fonts")
4887
- ];
4888
- if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
4889
- break skip_unused_node_modules;
4890
- }
4891
- return;
4892
- }
4893
5163
  }
4894
5164
  skip_unused_resources: {
4895
5165
  if (keycloakVersion !== "24.0.4") {
4896
5166
  break skip_unused_resources;
4897
5167
  }
4898
- for (const dirBasename of [
4899
- "@patternfly-v5",
4900
- "@rollup",
4901
- "rollup",
4902
- "react",
4903
- "react-dom",
4904
- "shx",
4905
- ".pnpm"
4906
- ]) {
4907
- if (isInside({
4908
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", dirBasename),
4909
- filePath: fileRelativePath
4910
- })) {
4911
- return;
5168
+ skip_node_modules: {
5169
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "node_modules"))) {
5170
+ break skip_node_modules;
5171
+ }
5172
+ if (kcNodeModulesKeepFilePaths === undefined) {
5173
+ kcNodeModulesKeepFilePaths = [
5174
+ (0,external_path_.join)("@patternfly", "patternfly", "patternfly.min.css"),
5175
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly.min.css"),
5176
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly-additions.min.css"),
5177
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Regular-webfont.woff2"),
5178
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Light-webfont.woff2"),
5179
+ (0,external_path_.join)("patternfly", "dist", "fonts", "fontawesome-webfont.woff2"),
5180
+ (0,external_path_.join)("jquery", "dist", "jquery.min.js")
5181
+ ];
5182
+ }
5183
+ for (const keepPath of kcNodeModulesKeepFilePaths) {
5184
+ if (fileRelativePath.endsWith(keepPath)) {
5185
+ break skip_node_modules;
5186
+ }
4912
5187
  }
5188
+ return;
4913
5189
  }
4914
- for (const dirBasename of ["react", "react-dom"]) {
4915
- if (isInside({
4916
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "vendor", dirBasename),
4917
- filePath: fileRelativePath
4918
- })) {
4919
- return;
5190
+ skip_vendor: {
5191
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "vendor"))) {
5192
+ break skip_vendor;
4920
5193
  }
5194
+ return;
4921
5195
  }
4922
- if (isInside({
4923
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", "@patternfly", "react-core"),
4924
- filePath: fileRelativePath
4925
- })) {
5196
+ skip_rollup_config: {
5197
+ if (fileRelativePath !==
5198
+ (0,external_path_.join)("keycloak", "common", "resources", "rollup.config.js")) {
5199
+ break skip_rollup_config;
5200
+ }
4926
5201
  return;
4927
5202
  }
4928
5203
  }
@@ -5060,101 +5335,31 @@ async function copyKeycloakResourcesToPublic(params) {
5060
5335
 
5061
5336
  /***/ }),
5062
5337
 
5063
- /***/ 7733:
5338
+ /***/ 8585:
5064
5339
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
5065
5340
 
5066
5341
  "use strict";
5067
- // ESM COMPAT FLAG
5068
5342
  __nccwpck_require__.r(__webpack_exports__);
5069
-
5070
- // EXPORTS
5071
- __nccwpck_require__.d(__webpack_exports__, {
5072
- "generateKcGenTs": () => (/* binding */ generateKcGenTs)
5073
- });
5074
-
5075
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
5076
- var assert = __nccwpck_require__(8078);
5077
- // EXTERNAL MODULE: external "fs"
5078
- var external_fs_ = __nccwpck_require__(7147);
5079
- // EXTERNAL MODULE: ./node_modules/tsafe/index.js
5080
- var tsafe = __nccwpck_require__(1666);
5081
- // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
5082
- var crawl = __nccwpck_require__(3036);
5083
- // EXTERNAL MODULE: external "path"
5084
- var external_path_ = __nccwpck_require__(1017);
5085
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
5086
- var constants = __nccwpck_require__(173);
5087
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
5088
- var source = __nccwpck_require__(8818);
5089
- var source_default = /*#__PURE__*/__nccwpck_require__.n(source);
5090
- ;// CONCATENATED MODULE: ./dist/bin/shared/getThemeSrcDirPath.js
5091
-
5092
-
5093
-
5094
-
5095
-
5096
-
5097
- let cache = undefined;
5098
- /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
5099
- function getThemeSrcDirPath(params) {
5100
- const { projectDirPath } = params;
5101
- if (cache !== undefined && cache.projectDirPath === projectDirPath) {
5102
- const { themeSrcDirPath } = cache;
5103
- return { themeSrcDirPath };
5104
- }
5105
- cache = undefined;
5106
- const { themeSrcDirPath } = (() => {
5107
- const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
5108
- const themeSrcDirPath = (0,crawl/* crawl */.J)({
5109
- dirPath: srcDirPath,
5110
- returnedPathsType: "relative to dirPath"
5111
- })
5112
- .map(fileRelativePath => {
5113
- for (const themeSrcDirBasename of themeSrcDirBasenames) {
5114
- const split = fileRelativePath.split(themeSrcDirBasename);
5115
- if (split.length === 2) {
5116
- return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
5117
- }
5118
- }
5119
- return undefined;
5120
- })
5121
- .filter((0,tsafe.exclude)(undefined))[0];
5122
- if (themeSrcDirPath !== undefined) {
5123
- return { themeSrcDirPath };
5124
- }
5125
- for (const themeType of [...constants.themeTypes, "email"]) {
5126
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
5127
- continue;
5128
- }
5129
- return { themeSrcDirPath: srcDirPath };
5130
- }
5131
- console.log(source_default().red("Can't locate your theme source directory. It should be either: "));
5132
- process.exit(-1);
5133
- })();
5134
- cache = { projectDirPath, themeSrcDirPath };
5135
- return { themeSrcDirPath };
5136
- }
5137
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
5138
- //# sourceMappingURL=getThemeSrcDirPath.js.map
5139
- // EXTERNAL MODULE: external "fs/promises"
5140
- var promises_ = __nccwpck_require__(3292);
5141
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
5142
- var fs_existsAsync = __nccwpck_require__(3765);
5143
- ;// CONCATENATED MODULE: ./dist/bin/shared/generateKcGenTs.js
5144
-
5343
+ /* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
5344
+ /* harmony export */ "generateKcGenTs": () => (/* binding */ generateKcGenTs)
5345
+ /* harmony export */ });
5346
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(8078);
5347
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(tsafe_assert__WEBPACK_IMPORTED_MODULE_0__);
5348
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(3292);
5349
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
5350
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(1017);
5351
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
5352
+ /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(3765);
5145
5353
 
5146
5354
 
5147
5355
 
5148
5356
 
5149
- (0,assert.assert)();
5357
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__.assert)();
5150
5358
  async function generateKcGenTs(params) {
5151
5359
  const { buildContext } = params;
5152
- const { themeSrcDirPath } = getThemeSrcDirPath({
5153
- projectDirPath: buildContext.projectDirPath
5154
- });
5155
- const filePath = (0,external_path_.join)(themeSrcDirPath, "kc.gen.ts");
5156
- const currentContent = (await (0,fs_existsAsync/* existsAsync */.o)(filePath))
5157
- ? await promises_.readFile(filePath)
5360
+ const filePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, "kc.gen.ts");
5361
+ const currentContent = (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))
5362
+ ? await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(filePath)
5158
5363
  : undefined;
5159
5364
  const newContent = Buffer.from([
5160
5365
  `/* prettier-ignore-start */`,
@@ -5183,7 +5388,7 @@ async function generateKcGenTs(params) {
5183
5388
  if (currentContent !== undefined && currentContent.equals(newContent)) {
5184
5389
  return;
5185
5390
  }
5186
- await promises_.writeFile(filePath, newContent);
5391
+ await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(filePath, newContent);
5187
5392
  }
5188
5393
  //# sourceMappingURL=generateKcGenTs.js.map
5189
5394
 
@@ -5430,11 +5635,11 @@ const path_1 = __nccwpck_require__(1017);
5430
5635
  const constants_1 = __nccwpck_require__(173);
5431
5636
  const id_1 = __nccwpck_require__(3047);
5432
5637
  const fs_rm_1 = __nccwpck_require__(8699);
5433
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(8272);
5638
+ const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(4901);
5434
5639
  const assert_1 = __nccwpck_require__(8078);
5435
5640
  const buildContext_1 = __nccwpck_require__(8355);
5436
5641
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
5437
- const generateKcGenTs_1 = __nccwpck_require__(7733);
5642
+ const generateKcGenTs_1 = __nccwpck_require__(8585);
5438
5643
  function keycloakify(params) {
5439
5644
  const { postBuild, ...buildOptions } = params !== null && params !== void 0 ? params : {};
5440
5645
  let projectDirPath = undefined;
@@ -5451,8 +5656,8 @@ function keycloakify(params) {
5451
5656
  if (envValue === undefined) {
5452
5657
  break run_post_build_script_case;
5453
5658
  }
5454
- const buildContext = JSON.parse(envValue);
5455
- process.chdir((0, path_1.join)(buildContext.keycloakifyBuildDirPath, "resources"));
5659
+ const { buildContext, resourcesDirPath } = JSON.parse(envValue);
5660
+ process.chdir(resourcesDirPath);
5456
5661
  await (postBuild === null || postBuild === void 0 ? void 0 : postBuild(buildContext));
5457
5662
  process.exit(0);
5458
5663
  }
@@ -42436,6 +42641,24 @@ exports.objectKeys = objectKeys;
42436
42641
 
42437
42642
  /***/ }),
42438
42643
 
42644
+ /***/ 6564:
42645
+ /***/ ((__unused_webpack_module, exports) => {
42646
+
42647
+ "use strict";
42648
+ var __webpack_unused_export__;
42649
+
42650
+ __webpack_unused_export__ = ({ value: true });
42651
+ exports.r = void 0;
42652
+ /** @see <https://docs.tsafe.dev/main/symtostr> */
42653
+ function symToStr(wrap) {
42654
+ // @ts-expect-error: We know better
42655
+ return Object.keys(wrap)[0];
42656
+ }
42657
+ exports.r = symToStr;
42658
+ //# sourceMappingURL=symToStr.js.map
42659
+
42660
+ /***/ }),
42661
+
42439
42662
  /***/ 7393:
42440
42663
  /***/ ((__unused_webpack_module, exports) => {
42441
42664