keycloakify 10.0.0-rc.65 → 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 (38) hide show
  1. package/bin/193.index.js +51 -0
  2. package/bin/246.index.js +371 -75118
  3. package/bin/363.index.js +64 -165
  4. package/bin/453.index.js +603 -23
  5. package/bin/{890.index.js → 456.index.js} +1831 -3
  6. package/bin/490.index.js +75195 -0
  7. package/bin/526.index.js +294 -173
  8. package/bin/538.index.js +1 -509
  9. package/bin/{203.index.js → 751.index.js} +306 -305
  10. package/bin/772.index.js +1 -1
  11. package/bin/{190.index.js → 837.index.js} +259 -35
  12. package/bin/932.index.js +1 -578
  13. package/bin/97.index.js +594 -14
  14. package/bin/main.js +8 -8
  15. package/bin/shared/buildContext.d.ts +16 -0
  16. package/bin/shared/constants.d.ts +1 -1
  17. package/bin/shared/constants.js +1 -1
  18. package/bin/shared/constants.js.map +1 -1
  19. package/package.json +5 -10
  20. package/src/bin/add-story.ts +1 -6
  21. package/src/bin/eject-page.ts +7 -8
  22. package/src/bin/initialize-email-theme.ts +1 -6
  23. package/src/bin/keycloakify/buildJars/buildJars.ts +23 -49
  24. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +15 -20
  25. package/src/bin/keycloakify/keycloakify.ts +6 -8
  26. package/src/bin/shared/buildContext.ts +434 -42
  27. package/src/bin/shared/constants.ts +2 -1
  28. package/src/bin/shared/generateKcGenTs.ts +2 -6
  29. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  30. package/src/bin/start-keycloak/start-keycloak.ts +40 -83
  31. package/src/vite-plugin/vite-plugin.ts +5 -4
  32. package/vite-plugin/index.js +341 -117
  33. package/bin/480.index.js +0 -466
  34. package/bin/818.index.js +0 -1802
  35. package/bin/827.index.js +0 -1094
  36. package/src/bin/shared/getImplementedThemeTypes.ts +0 -38
  37. package/src/bin/shared/getJarFileBasename.ts +0 -11
  38. 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",
@@ -5059,101 +5335,31 @@ async function copyKeycloakResourcesToPublic(params) {
5059
5335
 
5060
5336
  /***/ }),
5061
5337
 
5062
- /***/ 7733:
5338
+ /***/ 8585:
5063
5339
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
5064
5340
 
5065
5341
  "use strict";
5066
- // ESM COMPAT FLAG
5067
5342
  __nccwpck_require__.r(__webpack_exports__);
5068
-
5069
- // EXPORTS
5070
- __nccwpck_require__.d(__webpack_exports__, {
5071
- "generateKcGenTs": () => (/* binding */ generateKcGenTs)
5072
- });
5073
-
5074
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
5075
- var assert = __nccwpck_require__(8078);
5076
- // EXTERNAL MODULE: external "fs"
5077
- var external_fs_ = __nccwpck_require__(7147);
5078
- // EXTERNAL MODULE: ./node_modules/tsafe/index.js
5079
- var tsafe = __nccwpck_require__(1666);
5080
- // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
5081
- var crawl = __nccwpck_require__(3036);
5082
- // EXTERNAL MODULE: external "path"
5083
- var external_path_ = __nccwpck_require__(1017);
5084
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
5085
- var constants = __nccwpck_require__(173);
5086
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
5087
- var source = __nccwpck_require__(8818);
5088
- var source_default = /*#__PURE__*/__nccwpck_require__.n(source);
5089
- ;// CONCATENATED MODULE: ./dist/bin/shared/getThemeSrcDirPath.js
5090
-
5091
-
5092
-
5093
-
5094
-
5095
-
5096
- let cache = undefined;
5097
- /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
5098
- function getThemeSrcDirPath(params) {
5099
- const { projectDirPath } = params;
5100
- if (cache !== undefined && cache.projectDirPath === projectDirPath) {
5101
- const { themeSrcDirPath } = cache;
5102
- return { themeSrcDirPath };
5103
- }
5104
- cache = undefined;
5105
- const { themeSrcDirPath } = (() => {
5106
- const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
5107
- const themeSrcDirPath = (0,crawl/* crawl */.J)({
5108
- dirPath: srcDirPath,
5109
- returnedPathsType: "relative to dirPath"
5110
- })
5111
- .map(fileRelativePath => {
5112
- for (const themeSrcDirBasename of themeSrcDirBasenames) {
5113
- const split = fileRelativePath.split(themeSrcDirBasename);
5114
- if (split.length === 2) {
5115
- return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
5116
- }
5117
- }
5118
- return undefined;
5119
- })
5120
- .filter((0,tsafe.exclude)(undefined))[0];
5121
- if (themeSrcDirPath !== undefined) {
5122
- return { themeSrcDirPath };
5123
- }
5124
- for (const themeType of [...constants.themeTypes, "email"]) {
5125
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
5126
- continue;
5127
- }
5128
- return { themeSrcDirPath: srcDirPath };
5129
- }
5130
- console.log(source_default().red("Can't locate your theme source directory. It should be either: "));
5131
- process.exit(-1);
5132
- })();
5133
- cache = { projectDirPath, themeSrcDirPath };
5134
- return { themeSrcDirPath };
5135
- }
5136
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
5137
- //# sourceMappingURL=getThemeSrcDirPath.js.map
5138
- // EXTERNAL MODULE: external "fs/promises"
5139
- var promises_ = __nccwpck_require__(3292);
5140
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
5141
- var fs_existsAsync = __nccwpck_require__(3765);
5142
- ;// CONCATENATED MODULE: ./dist/bin/shared/generateKcGenTs.js
5143
-
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);
5144
5353
 
5145
5354
 
5146
5355
 
5147
5356
 
5148
- (0,assert.assert)();
5357
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__.assert)();
5149
5358
  async function generateKcGenTs(params) {
5150
5359
  const { buildContext } = params;
5151
- const { themeSrcDirPath } = getThemeSrcDirPath({
5152
- projectDirPath: buildContext.projectDirPath
5153
- });
5154
- const filePath = (0,external_path_.join)(themeSrcDirPath, "kc.gen.ts");
5155
- const currentContent = (await (0,fs_existsAsync/* existsAsync */.o)(filePath))
5156
- ? 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)
5157
5363
  : undefined;
5158
5364
  const newContent = Buffer.from([
5159
5365
  `/* prettier-ignore-start */`,
@@ -5182,7 +5388,7 @@ async function generateKcGenTs(params) {
5182
5388
  if (currentContent !== undefined && currentContent.equals(newContent)) {
5183
5389
  return;
5184
5390
  }
5185
- await promises_.writeFile(filePath, newContent);
5391
+ await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(filePath, newContent);
5186
5392
  }
5187
5393
  //# sourceMappingURL=generateKcGenTs.js.map
5188
5394
 
@@ -5433,7 +5639,7 @@ const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(4901);
5433
5639
  const assert_1 = __nccwpck_require__(8078);
5434
5640
  const buildContext_1 = __nccwpck_require__(8355);
5435
5641
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
5436
- const generateKcGenTs_1 = __nccwpck_require__(7733);
5642
+ const generateKcGenTs_1 = __nccwpck_require__(8585);
5437
5643
  function keycloakify(params) {
5438
5644
  const { postBuild, ...buildOptions } = params !== null && params !== void 0 ? params : {};
5439
5645
  let projectDirPath = undefined;
@@ -5450,8 +5656,8 @@ function keycloakify(params) {
5450
5656
  if (envValue === undefined) {
5451
5657
  break run_post_build_script_case;
5452
5658
  }
5453
- const buildContext = JSON.parse(envValue);
5454
- process.chdir((0, path_1.join)(buildContext.keycloakifyBuildDirPath, "resources"));
5659
+ const { buildContext, resourcesDirPath } = JSON.parse(envValue);
5660
+ process.chdir(resourcesDirPath);
5455
5661
  await (postBuild === null || postBuild === void 0 ? void 0 : postBuild(buildContext));
5456
5662
  process.exit(0);
5457
5663
  }
@@ -42435,6 +42641,24 @@ exports.objectKeys = objectKeys;
42435
42641
 
42436
42642
  /***/ }),
42437
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
+
42438
42662
  /***/ 7393:
42439
42663
  /***/ ((__unused_webpack_module, exports) => {
42440
42664