keycloakify 10.0.0-rc.38 → 10.0.0-rc.39

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 (81) hide show
  1. package/bin/193.index.js +13 -13
  2. package/bin/3.index.js +86 -86
  3. package/bin/322.index.js +595 -0
  4. package/bin/453.index.js +3 -3
  5. package/bin/526.index.js +42 -633
  6. package/bin/538.index.js +68 -57
  7. package/bin/932.index.js +7 -7
  8. package/bin/944.index.js +621 -0
  9. package/bin/961.index.js +5 -5
  10. package/bin/97.index.js +3 -3
  11. package/bin/{21.index.js → 98.index.js} +59 -48
  12. package/bin/main.js +8 -8
  13. package/lib/getKcClsx.js +12 -1
  14. package/lib/getKcClsx.js.map +1 -1
  15. package/login/Fallback.d.ts +1 -0
  16. package/login/Fallback.js.map +1 -1
  17. package/login/UserProfileFormFields.d.ts +1 -0
  18. package/login/UserProfileFormFields.js +1 -3
  19. package/login/UserProfileFormFields.js.map +1 -1
  20. package/login/i18n/i18n.js +1 -1
  21. package/login/pages/IdpReviewUserProfile.d.ts +1 -0
  22. package/login/pages/IdpReviewUserProfile.js +2 -2
  23. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  24. package/login/pages/LoginUpdateProfile.d.ts +1 -0
  25. package/login/pages/LoginUpdateProfile.js +2 -2
  26. package/login/pages/LoginUpdateProfile.js.map +1 -1
  27. package/login/pages/Register.d.ts +1 -0
  28. package/login/pages/Register.js +2 -2
  29. package/login/pages/Register.js.map +1 -1
  30. package/login/pages/UpdateEmail.d.ts +1 -0
  31. package/login/pages/UpdateEmail.js +2 -2
  32. package/login/pages/UpdateEmail.js.map +1 -1
  33. package/package.json +5 -8
  34. package/src/bin/add-story.ts +3 -3
  35. package/src/bin/copy-keycloak-resources-to-public.ts +3 -3
  36. package/src/bin/download-keycloak-default-theme.ts +5 -5
  37. package/src/bin/eject-page.ts +3 -3
  38. package/src/bin/initialize-email-theme.ts +5 -5
  39. package/src/bin/keycloakify/buildJars/buildJar.ts +14 -14
  40. package/src/bin/keycloakify/buildJars/buildJars.ts +8 -8
  41. package/src/bin/keycloakify/buildJars/generatePom.ts +9 -9
  42. package/src/bin/keycloakify/generateFtl/generateFtl.ts +12 -12
  43. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +7 -7
  44. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +9 -9
  45. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +25 -25
  46. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +8 -8
  47. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +9 -9
  48. package/src/bin/keycloakify/keycloakify.ts +11 -11
  49. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +6 -6
  50. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +7 -7
  51. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +10 -10
  52. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +13 -13
  53. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +11 -11
  54. package/src/bin/main.ts +2 -2
  55. package/src/bin/shared/{buildOptions.ts → buildContext.ts} +62 -51
  56. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +12 -12
  57. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +7 -7
  58. package/src/bin/shared/downloadKeycloakStaticResources.ts +7 -7
  59. package/src/bin/shared/generateKcGenTs.ts +12 -12
  60. package/src/bin/shared/getThemeSrcDirPath.ts +3 -3
  61. package/src/bin/start-keycloak/appBuild.ts +11 -11
  62. package/src/bin/start-keycloak/keycloakifyBuild.ts +7 -7
  63. package/src/bin/start-keycloak/start-keycloak.ts +34 -22
  64. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +3 -3
  65. package/src/bin/update-kc-gen.ts +3 -3
  66. package/src/lib/getKcClsx.ts +15 -1
  67. package/src/login/Fallback.tsx +1 -0
  68. package/src/login/UserProfileFormFields.tsx +2 -4
  69. package/src/login/i18n/i18n.tsx +1 -1
  70. package/src/login/pages/IdpReviewUserProfile.tsx +8 -2
  71. package/src/login/pages/LoginUpdateProfile.tsx +8 -2
  72. package/src/login/pages/Register.tsx +8 -2
  73. package/src/login/pages/UpdateEmail.tsx +8 -2
  74. package/src/vite-plugin/vite-plugin.ts +19 -19
  75. package/vite-plugin/index.js +91 -80
  76. package/vite-plugin/vite-plugin.d.ts +3 -3
  77. package/bin/795.index.js +0 -1198
  78. package/lib/isStorybook.d.ts +0 -1
  79. package/lib/isStorybook.js +0 -3
  80. package/lib/isStorybook.js.map +0 -1
  81. package/src/lib/isStorybook.ts +0 -3
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 6757:
4
+ /***/ 8355:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
6
 
7
7
  "use strict";
@@ -10,7 +10,7 @@ __nccwpck_require__.r(__webpack_exports__);
10
10
 
11
11
  // EXPORTS
12
12
  __nccwpck_require__.d(__webpack_exports__, {
13
- "readBuildOptions": () => (/* binding */ readBuildOptions)
13
+ "getBuildContext": () => (/* binding */ getBuildContext)
14
14
  });
15
15
 
16
16
  // EXTERNAL MODULE: external "url"
@@ -49,9 +49,9 @@ var external_fs_ = __nccwpck_require__(7147);
49
49
 
50
50
 
51
51
  function getNpmWorkspaceRootDirPath(params) {
52
- const { reactAppRootDirPath, dependencyExpected } = params;
52
+ const { projectDirPath, dependencyExpected } = params;
53
53
  const npmWorkspaceRootDirPath = (function callee(depth) {
54
- const cwd = (0,external_path_.resolve)((0,external_path_.join)(...[reactAppRootDirPath, ...Array(depth).fill("..")]));
54
+ const cwd = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(depth).fill("..")]));
55
55
  (0,assert.assert)(cwd !== external_path_.sep, "NPM workspace not found");
56
56
  try {
57
57
  external_child_process_.execSync("npm config get", {
@@ -4053,7 +4053,7 @@ var z = /*#__PURE__*/Object.freeze({
4053
4053
  var tsafe = __nccwpck_require__(1666);
4054
4054
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
4055
4055
  var constants = __nccwpck_require__(173);
4056
- ;// CONCATENATED MODULE: ./dist/bin/shared/buildOptions.js
4056
+ ;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
4057
4057
 
4058
4058
 
4059
4059
 
@@ -4063,26 +4063,26 @@ var constants = __nccwpck_require__(173);
4063
4063
 
4064
4064
 
4065
4065
 
4066
- function readBuildOptions(params) {
4066
+ function getBuildContext(params) {
4067
4067
  var _a, _b, _c, _d, _e, _f;
4068
4068
  const { cliCommandOptions } = params;
4069
- const reactAppRootDirPath = (() => {
4070
- if (cliCommandOptions.reactAppRootDirPath === undefined) {
4069
+ const projectDirPath = (() => {
4070
+ if (cliCommandOptions.projectDirPath === undefined) {
4071
4071
  return process.cwd();
4072
4072
  }
4073
4073
  return getAbsoluteAndInOsFormatPath({
4074
- pathIsh: cliCommandOptions.reactAppRootDirPath,
4074
+ pathIsh: cliCommandOptions.projectDirPath,
4075
4075
  cwd: process.cwd()
4076
4076
  });
4077
4077
  })();
4078
4078
  const { resolvedViteConfig } = (() => {
4079
- if (external_fs_.readdirSync(reactAppRootDirPath)
4079
+ if (external_fs_.readdirSync(projectDirPath)
4080
4080
  .find(fileBasename => fileBasename.startsWith("vite.config")) ===
4081
4081
  undefined) {
4082
4082
  return { resolvedViteConfig: undefined };
4083
4083
  }
4084
4084
  const output = external_child_process_.execSync("npx vite", {
4085
- cwd: reactAppRootDirPath,
4085
+ cwd: projectDirPath,
4086
4086
  env: Object.assign(Object.assign({}, process.env), { [constants.vitePluginSubScriptEnvNames.resolveViteConfig]: "true" })
4087
4087
  })
4088
4088
  .toString("utf8");
@@ -4103,7 +4103,7 @@ function readBuildOptions(params) {
4103
4103
  artifactId: z.string().optional(),
4104
4104
  groupId: z.string().optional(),
4105
4105
  loginThemeResourcesFromKeycloakVersion: z.string().optional(),
4106
- reactAppBuildDirPath: z.string().optional(),
4106
+ projectBuildDirPath: z.string().optional(),
4107
4107
  keycloakifyBuildDirPath: z.string().optional(),
4108
4108
  themeName: z.union([z.string(), z.array(z.string())]).optional()
4109
4109
  })
@@ -4113,12 +4113,11 @@ function readBuildOptions(params) {
4113
4113
  (0,tsafe.assert)();
4114
4114
  (0,tsafe.assert)();
4115
4115
  }
4116
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(reactAppRootDirPath, "package.json"))
4117
- .toString("utf8")));
4116
+ return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(projectDirPath, "package.json")).toString("utf8")));
4118
4117
  })();
4119
- const userProvidedBuildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.userProvidedBuildOptions);
4118
+ const buildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildOptions);
4120
4119
  const themeNames = (() => {
4121
- if (userProvidedBuildOptions.themeName === undefined) {
4120
+ if (buildOptions.themeName === undefined) {
4122
4121
  return [
4123
4122
  parsedPackageJson.name
4124
4123
  .replace(/^@(.*)/, "$1")
@@ -4126,56 +4125,56 @@ function readBuildOptions(params) {
4126
4125
  .join("-")
4127
4126
  ];
4128
4127
  }
4129
- if (typeof userProvidedBuildOptions.themeName === "string") {
4130
- return [userProvidedBuildOptions.themeName];
4128
+ if (typeof buildOptions.themeName === "string") {
4129
+ return [buildOptions.themeName];
4131
4130
  }
4132
- return userProvidedBuildOptions.themeName;
4131
+ return buildOptions.themeName;
4133
4132
  })();
4134
- const reactAppBuildDirPath = (() => {
4133
+ const projectBuildDirPath = (() => {
4135
4134
  var _a;
4136
4135
  webpack: {
4137
4136
  if (resolvedViteConfig !== undefined) {
4138
4137
  break webpack;
4139
4138
  }
4140
- if (((_a = parsedPackageJson.keycloakify) === null || _a === void 0 ? void 0 : _a.reactAppBuildDirPath) !== undefined) {
4139
+ if (((_a = parsedPackageJson.keycloakify) === null || _a === void 0 ? void 0 : _a.projectBuildDirPath) !== undefined) {
4141
4140
  return getAbsoluteAndInOsFormatPath({
4142
- pathIsh: parsedPackageJson.keycloakify.reactAppBuildDirPath,
4143
- cwd: reactAppRootDirPath
4141
+ pathIsh: parsedPackageJson.keycloakify.projectBuildDirPath,
4142
+ cwd: projectDirPath
4144
4143
  });
4145
4144
  }
4146
- return (0,external_path_.join)(reactAppRootDirPath, "build");
4145
+ return (0,external_path_.join)(projectDirPath, "build");
4147
4146
  }
4148
- return (0,external_path_.join)(reactAppRootDirPath, resolvedViteConfig.buildDir);
4147
+ return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
4149
4148
  })();
4150
4149
  const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
4151
- reactAppRootDirPath,
4150
+ projectDirPath,
4152
4151
  dependencyExpected: "keycloakify"
4153
4152
  });
4154
4153
  return {
4155
4154
  bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
4156
4155
  themeVersion: (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
4157
4156
  themeNames,
4158
- extraThemeProperties: userProvidedBuildOptions.extraThemeProperties,
4157
+ extraThemeProperties: buildOptions.extraThemeProperties,
4159
4158
  groupId: (() => {
4160
4159
  var _a, _b, _c, _d, _e;
4161
4160
  const fallbackGroupId = `${themeNames[0]}.keycloak`;
4162
- return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : userProvidedBuildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
4161
+ return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : buildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
4163
4162
  ? fallbackGroupId
4164
4163
  : (_e = (_d = (_c = (0,external_url_.parse)(parsedPackageJson.homepage)
4165
4164
  .host) === null || _c === void 0 ? void 0 : _c.replace(/:[0-9]+$/, "")) === null || _d === void 0 ? void 0 : _d.split(".").reverse().join(".")) !== null && _e !== void 0 ? _e : fallbackGroupId) + ".keycloak");
4166
4165
  })(),
4167
- artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : userProvidedBuildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
4168
- loginThemeResourcesFromKeycloakVersion: (_e = userProvidedBuildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
4169
- reactAppRootDirPath,
4170
- reactAppBuildDirPath,
4166
+ artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : buildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
4167
+ loginThemeResourcesFromKeycloakVersion: (_e = buildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
4168
+ projectDirPath,
4169
+ projectBuildDirPath,
4171
4170
  keycloakifyBuildDirPath: (() => {
4172
- if (userProvidedBuildOptions.keycloakifyBuildDirPath !== undefined) {
4171
+ if (buildOptions.keycloakifyBuildDirPath !== undefined) {
4173
4172
  return getAbsoluteAndInOsFormatPath({
4174
- pathIsh: userProvidedBuildOptions.keycloakifyBuildDirPath,
4175
- cwd: reactAppRootDirPath
4173
+ pathIsh: buildOptions.keycloakifyBuildDirPath,
4174
+ cwd: projectDirPath
4176
4175
  });
4177
4176
  }
4178
- return (0,external_path_.join)(reactAppRootDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
4177
+ return (0,external_path_.join)(projectDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
4179
4178
  ? "build_keycloak"
4180
4179
  : `${resolvedViteConfig.buildDir}_keycloak`);
4181
4180
  })(),
@@ -4187,12 +4186,12 @@ function readBuildOptions(params) {
4187
4186
  if (process.env.PUBLIC_DIR_PATH !== undefined) {
4188
4187
  return getAbsoluteAndInOsFormatPath({
4189
4188
  pathIsh: process.env.PUBLIC_DIR_PATH,
4190
- cwd: reactAppRootDirPath
4189
+ cwd: projectDirPath
4191
4190
  });
4192
4191
  }
4193
- return (0,external_path_.join)(reactAppRootDirPath, "public");
4192
+ return (0,external_path_.join)(projectDirPath, "public");
4194
4193
  }
4195
- return (0,external_path_.join)(reactAppRootDirPath, resolvedViteConfig.publicDir);
4194
+ return (0,external_path_.join)(projectDirPath, resolvedViteConfig.publicDir);
4196
4195
  })(),
4197
4196
  cacheDirPath: (() => {
4198
4197
  const cacheDirPath = (0,external_path_.join)((() => {
@@ -4229,16 +4228,28 @@ function readBuildOptions(params) {
4229
4228
  if (resolvedViteConfig !== undefined) {
4230
4229
  break webpack;
4231
4230
  }
4232
- return (0,external_path_.join)(reactAppBuildDirPath, "static");
4231
+ return (0,external_path_.join)(projectBuildDirPath, "static");
4233
4232
  }
4234
- return (0,external_path_.join)(reactAppBuildDirPath, resolvedViteConfig.assetsDir);
4233
+ return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
4235
4234
  })(),
4236
4235
  npmWorkspaceRootDirPath,
4237
- kcContextExclusionsFtlCode: userProvidedBuildOptions.kcContextExclusionsFtlCode,
4238
- environmentVariables: (_f = userProvidedBuildOptions.environmentVariables) !== null && _f !== void 0 ? _f : []
4236
+ kcContextExclusionsFtlCode: (() => {
4237
+ if (buildOptions.kcContextExclusionsFtl === undefined) {
4238
+ return undefined;
4239
+ }
4240
+ if (buildOptions.kcContextExclusionsFtl.endsWith(".ftl")) {
4241
+ const kcContextExclusionsFtlPath = getAbsoluteAndInOsFormatPath({
4242
+ pathIsh: buildOptions.kcContextExclusionsFtl,
4243
+ cwd: projectDirPath
4244
+ });
4245
+ return external_fs_.readFileSync(kcContextExclusionsFtlPath).toString("utf8");
4246
+ }
4247
+ return buildOptions.kcContextExclusionsFtl;
4248
+ })(),
4249
+ environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : []
4239
4250
  };
4240
4251
  }
4241
- //# sourceMappingURL=buildOptions.js.map
4252
+ //# sourceMappingURL=buildContext.js.map
4242
4253
 
4243
4254
  /***/ }),
4244
4255
 
@@ -4810,11 +4821,11 @@ function isInside(params) {
4810
4821
 
4811
4822
  (0,assert.assert)();
4812
4823
  async function downloadKeycloakDefaultTheme(params) {
4813
- const { keycloakVersion, buildOptions } = params;
4824
+ const { keycloakVersion, buildContext } = params;
4814
4825
  const { extractedDirPath } = await downloadAndExtractArchive({
4815
4826
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
4816
- cacheDirPath: buildOptions.cacheDirPath,
4817
- npmWorkspaceRootDirPath: buildOptions.npmWorkspaceRootDirPath,
4827
+ cacheDirPath: buildContext.cacheDirPath,
4828
+ npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
4818
4829
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
4819
4830
  onArchiveFile: async (params) => {
4820
4831
  if (!isInside({ dirPath: "theme", filePath: params.fileRelativePath })) {
@@ -4929,10 +4940,10 @@ async function downloadKeycloakDefaultTheme(params) {
4929
4940
 
4930
4941
  (0,assert.assert)();
4931
4942
  async function downloadKeycloakStaticResources(params) {
4932
- const { themeType, themeDirPath, keycloakVersion, buildOptions } = params;
4943
+ const { themeType, themeDirPath, keycloakVersion, buildContext } = params;
4933
4944
  const { defaultThemeDirPath } = await downloadKeycloakDefaultTheme({
4934
4945
  keycloakVersion,
4935
- buildOptions
4946
+ buildContext
4936
4947
  });
4937
4948
  const resourcesDirPath = (0,external_path_.join)(themeDirPath, themeType, "resources");
4938
4949
  repatriate_base_resources: {
@@ -4994,16 +5005,16 @@ function readThisNpmPackageVersion() {
4994
5005
 
4995
5006
  (0,assert.assert)();
4996
5007
  async function copyKeycloakResourcesToPublic(params) {
4997
- const { buildOptions } = params;
4998
- const destDirPath = (0,external_path_.join)(buildOptions.publicDirPath, constants.keycloak_resources);
5008
+ const { buildContext } = params;
5009
+ const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.keycloak_resources);
4999
5010
  const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
5000
5011
  const keycloakifyBuildinfoRaw = JSON.stringify({
5001
5012
  destDirPath,
5002
5013
  keycloakifyVersion: readThisNpmPackageVersion(),
5003
- buildOptions: {
5014
+ buildContext: {
5004
5015
  loginThemeResourcesFromKeycloakVersion: readThisNpmPackageVersion(),
5005
- cacheDirPath: (0,external_path_.relative)(destDirPath, buildOptions.cacheDirPath),
5006
- npmWorkspaceRootDirPath: (0,external_path_.relative)(destDirPath, buildOptions.npmWorkspaceRootDirPath)
5016
+ cacheDirPath: (0,external_path_.relative)(destDirPath, buildContext.cacheDirPath),
5017
+ npmWorkspaceRootDirPath: (0,external_path_.relative)(destDirPath, buildContext.npmWorkspaceRootDirPath)
5007
5018
  }
5008
5019
  }, null, 2);
5009
5020
  skip_if_already_done: {
@@ -5025,14 +5036,14 @@ async function copyKeycloakResourcesToPublic(params) {
5025
5036
  keycloakVersion: (() => {
5026
5037
  switch (themeType) {
5027
5038
  case "login":
5028
- return buildOptions.loginThemeResourcesFromKeycloakVersion;
5039
+ return buildContext.loginThemeResourcesFromKeycloakVersion;
5029
5040
  case "account":
5030
5041
  return constants.lastKeycloakVersionWithAccountV1;
5031
5042
  }
5032
5043
  })(),
5033
5044
  themeType,
5034
5045
  themeDirPath: destDirPath,
5035
- buildOptions
5046
+ buildContext
5036
5047
  });
5037
5048
  }
5038
5049
  external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
@@ -5081,8 +5092,8 @@ var constants = __nccwpck_require__(173);
5081
5092
  const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
5082
5093
  /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
5083
5094
  function getThemeSrcDirPath(params) {
5084
- const { reactAppRootDirPath } = params;
5085
- const srcDirPath = (0,external_path_.join)(reactAppRootDirPath, "src");
5095
+ const { projectDirPath } = params;
5096
+ const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
5086
5097
  const themeSrcDirPath = (0,crawl/* crawl */.J)({
5087
5098
  dirPath: srcDirPath,
5088
5099
  returnedPathsType: "relative to dirPath"
@@ -5123,9 +5134,9 @@ var promises_ = __nccwpck_require__(3292);
5123
5134
 
5124
5135
  (0,assert.assert)();
5125
5136
  async function generateKcGenTs(params) {
5126
- const { buildOptions } = params;
5137
+ const { buildContext } = params;
5127
5138
  const { themeSrcDirPath } = getThemeSrcDirPath({
5128
- reactAppRootDirPath: buildOptions.reactAppRootDirPath
5139
+ projectDirPath: buildContext.projectDirPath
5129
5140
  });
5130
5141
  await promises_.writeFile((0,external_path_.join)(themeSrcDirPath, "kc.gen.ts"), Buffer.from([
5131
5142
  `/* prettier-ignore-start */`,
@@ -5138,15 +5149,15 @@ async function generateKcGenTs(params) {
5138
5149
  ``,
5139
5150
  `// This file is auto-generated by Keycloakify`,
5140
5151
  ``,
5141
- `export type ThemeName = ${buildOptions.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
5152
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
5142
5153
  ``,
5143
- `export const themeNames: ThemeName[] = [${buildOptions.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
5154
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
5144
5155
  ``,
5145
- `export type KcEnvName = ${buildOptions.environmentVariables.length === 0 ? "never" : buildOptions.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
5156
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
5146
5157
  ``,
5147
- `export const KcEnvNames: KcEnvName[] = [${buildOptions.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
5158
+ `export const KcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
5148
5159
  ``,
5149
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildOptions.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
5160
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
5150
5161
  ``,
5151
5162
  `/* prettier-ignore-end */`
5152
5163
  ].join("\n"), "utf8"));
@@ -5373,12 +5384,12 @@ const id_1 = __nccwpck_require__(3047);
5373
5384
  const fs_rm_1 = __nccwpck_require__(8699);
5374
5385
  const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(8047);
5375
5386
  const assert_1 = __nccwpck_require__(8078);
5376
- const buildOptions_1 = __nccwpck_require__(6757);
5387
+ const buildContext_1 = __nccwpck_require__(8355);
5377
5388
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
5378
5389
  const generateKcGenTs_1 = __nccwpck_require__(7733);
5379
5390
  function keycloakify(params) {
5380
- const { postBuild, ...userProvidedBuildOptions } = params !== null && params !== void 0 ? params : {};
5381
- let reactAppRootDirPath = undefined;
5391
+ const { postBuild, ...buildOptions } = params !== null && params !== void 0 ? params : {};
5392
+ let projectDirPath = undefined;
5382
5393
  let urlPathname = undefined;
5383
5394
  let buildDirPath = undefined;
5384
5395
  let command = undefined;
@@ -5392,12 +5403,12 @@ function keycloakify(params) {
5392
5403
  if (envValue === undefined) {
5393
5404
  break run_post_build_script_case;
5394
5405
  }
5395
- const buildOptions = JSON.parse(envValue);
5396
- await (postBuild === null || postBuild === void 0 ? void 0 : postBuild(buildOptions));
5406
+ const buildContext = JSON.parse(envValue);
5407
+ await (postBuild === null || postBuild === void 0 ? void 0 : postBuild(buildContext));
5397
5408
  process.exit(0);
5398
5409
  }
5399
5410
  command = resolvedConfig.command;
5400
- reactAppRootDirPath = resolvedConfig.root;
5411
+ projectDirPath = resolvedConfig.root;
5401
5412
  urlPathname = (() => {
5402
5413
  var _a;
5403
5414
  let out = resolvedConfig.env.BASE_URL;
@@ -5420,7 +5431,7 @@ function keycloakify(params) {
5420
5431
  }
5421
5432
  return out;
5422
5433
  })();
5423
- buildDirPath = (0, path_1.join)(reactAppRootDirPath, resolvedConfig.build.outDir);
5434
+ buildDirPath = (0, path_1.join)(projectDirPath, resolvedConfig.build.outDir);
5424
5435
  resolve_vite_config_case: {
5425
5436
  const envValue = process.env[constants_1.vitePluginSubScriptEnvNames.resolveViteConfig];
5426
5437
  if (envValue === undefined) {
@@ -5428,25 +5439,25 @@ function keycloakify(params) {
5428
5439
  }
5429
5440
  console.log(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig);
5430
5441
  console.log(JSON.stringify((0, id_1.id)({
5431
- publicDir: (0, path_1.relative)(reactAppRootDirPath, resolvedConfig.publicDir),
5442
+ publicDir: (0, path_1.relative)(projectDirPath, resolvedConfig.publicDir),
5432
5443
  assetsDir: resolvedConfig.build.assetsDir,
5433
5444
  buildDir: resolvedConfig.build.outDir,
5434
5445
  urlPathname,
5435
- userProvidedBuildOptions
5446
+ buildOptions
5436
5447
  })));
5437
5448
  process.exit(0);
5438
5449
  }
5439
- const buildOptions = (0, buildOptions_1.readBuildOptions)({
5450
+ const buildContext = (0, buildContext_1.getBuildContext)({
5440
5451
  cliCommandOptions: {
5441
- reactAppRootDirPath
5452
+ projectDirPath
5442
5453
  }
5443
5454
  });
5444
5455
  await Promise.all([
5445
5456
  (0, copyKeycloakResourcesToPublic_1.copyKeycloakResourcesToPublic)({
5446
- buildOptions
5457
+ buildContext
5447
5458
  }),
5448
5459
  (0, generateKcGenTs_1.generateKcGenTs)({
5449
- buildOptions
5460
+ buildContext
5450
5461
  })
5451
5462
  ]);
5452
5463
  },
@@ -5456,9 +5467,9 @@ function keycloakify(params) {
5456
5467
  if (command !== "build") {
5457
5468
  return;
5458
5469
  }
5459
- (0, assert_1.assert)(reactAppRootDirPath !== undefined);
5470
+ (0, assert_1.assert)(projectDirPath !== undefined);
5460
5471
  {
5461
- const isWithinSourceDirectory = id.startsWith((0, path_1.join)(reactAppRootDirPath, "src") + path_1.sep);
5472
+ const isWithinSourceDirectory = id.startsWith((0, path_1.join)(projectDirPath, "src") + path_1.sep);
5462
5473
  if (!isWithinSourceDirectory) {
5463
5474
  return;
5464
5475
  }
@@ -1,5 +1,5 @@
1
- import { type BuildOptions, type UserProvidedBuildOptions } from "../bin/shared/buildOptions";
2
- export type Params = UserProvidedBuildOptions & {
3
- postBuild?: (buildOptions: Omit<BuildOptions, "bundler">) => Promise<void>;
1
+ import { type BuildContext, type BuildOptions } from "../bin/shared/buildContext";
2
+ export type Params = BuildOptions & {
3
+ postBuild?: (buildContext: Omit<BuildContext, "bundler">) => Promise<void>;
4
4
  };
5
5
  export declare function keycloakify(params?: Params): any;