keycloakify 11.6.1 → 11.7.0

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 (96) hide show
  1. package/bin/{653.index.js → 288.index.js} +221 -201
  2. package/bin/313.index.js +377 -0
  3. package/bin/{174.index.js → 33.index.js} +37 -2
  4. package/bin/{615.index.js → 355.index.js} +353 -102
  5. package/bin/363.index.js +1537 -0
  6. package/bin/453.index.js +6 -42
  7. package/bin/{503.index.js → 678.index.js} +577 -53
  8. package/bin/{921.index.js → 780.index.js} +54 -45
  9. package/bin/880.index.js +206 -21
  10. package/bin/9.index.js +850 -0
  11. package/bin/{525.index.js → 911.index.js} +1302 -2
  12. package/bin/930.index.js +164 -0
  13. package/bin/946.index.js +20 -0
  14. package/bin/{153.index.js → 947.index.js} +22 -797
  15. package/bin/main.js +61 -19
  16. package/bin/{eject-file.d.ts → own.d.ts} +2 -1
  17. package/bin/shared/{addPostinstallScriptIfNotPresent.d.ts → initializeSpa/addSyncExtensionsToPostinstallScript.d.ts} +1 -1
  18. package/bin/shared/initializeSpa/index.d.ts +1 -0
  19. package/bin/shared/initializeSpa/initializeSpa.d.ts +9 -0
  20. package/bin/{postinstall/uiModuleMeta.d.ts → sync-extensions/extensionModuleMeta.d.ts} +5 -5
  21. package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
  22. package/bin/sync-extensions/index.d.ts +1 -0
  23. package/bin/{postinstall/installUiModulesPeerDependencies.d.ts → sync-extensions/installExtensionModulesPeerDependencies.d.ts} +3 -3
  24. package/bin/{postinstall → sync-extensions}/managedGitignoreFile.d.ts +4 -4
  25. package/bin/tools/getInstalledModuleDirPath.d.ts +0 -1
  26. package/bin/tools/isKnownByGit.d.ts +3 -0
  27. package/bin/tools/isRootPath.d.ts +1 -0
  28. package/bin/tools/listInstalledModules.d.ts +0 -1
  29. package/package.json +41 -63
  30. package/src/bin/eject-page.ts +8 -84
  31. package/src/bin/initialize-account-theme/initialize-account-theme.ts +15 -14
  32. package/src/bin/initialize-admin-theme.ts +17 -124
  33. package/src/bin/initialize-email-theme.ts +10 -34
  34. package/src/bin/keycloakify/generateResources/generateResources.ts +49 -21
  35. package/src/bin/main.ts +61 -16
  36. package/src/bin/own.ts +208 -0
  37. package/src/bin/shared/{addPostinstallScriptIfNotPresent.ts → initializeSpa/addSyncExtensionsToPostinstallScript.ts} +4 -4
  38. package/src/bin/shared/initializeSpa/index.ts +1 -0
  39. package/src/bin/shared/initializeSpa/initializeSpa.ts +149 -0
  40. package/src/bin/{postinstall/uiModuleMeta.ts → sync-extensions/extensionModuleMeta.ts} +48 -43
  41. package/src/bin/{postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts → sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts} +32 -21
  42. package/src/bin/sync-extensions/index.ts +1 -0
  43. package/src/bin/{postinstall/installUiModulesPeerDependencies.ts → sync-extensions/installExtensionModulesPeerDependencies.ts} +15 -13
  44. package/src/bin/{postinstall → sync-extensions}/managedGitignoreFile.ts +18 -18
  45. package/src/bin/{postinstall/postinstall.ts → sync-extensions/sync-extension.ts} +14 -26
  46. package/src/bin/tools/getInstalledModuleDirPath.ts +24 -22
  47. package/src/bin/tools/isKnownByGit.ts +45 -0
  48. package/src/bin/tools/isRootPath.ts +22 -0
  49. package/src/bin/tools/listInstalledModules.ts +4 -6
  50. package/src/bin/tools/npmInstall.ts +1 -1
  51. package/src/bin/tools/untrackFromGit.ts +19 -3
  52. package/src/bin/tsconfig.json +1 -1
  53. package/bin/300.index.js +0 -770
  54. package/bin/375.index.js +0 -4089
  55. package/bin/490.index.js +0 -1108
  56. package/bin/568.index.js +0 -1867
  57. package/bin/735.index.js +0 -907
  58. package/bin/743.index.js +0 -69
  59. package/bin/854.index.js +0 -68
  60. package/bin/initialize-account-theme/copyBoilerplate.d.ts +0 -4
  61. package/bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts +0 -3
  62. package/bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts +0 -11
  63. package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +0 -12
  64. package/bin/postinstall/index.d.ts +0 -1
  65. package/bin/shared/getLatestsSemVersionedTag.d.ts +0 -15
  66. package/bin/shared/promptKeycloakVersion.d.ts +0 -10
  67. package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
  68. package/bin/tools/crc32.d.ts +0 -9
  69. package/bin/tools/deflate.d.ts +0 -24
  70. package/bin/tools/isTrackedByGit.d.ts +0 -3
  71. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -15
  72. package/bin/tools/octokit-addons/listTags.d.ts +0 -13
  73. package/bin/tools/tee.d.ts +0 -3
  74. package/bin/tools/trimIndent.d.ts +0 -5
  75. package/src/bin/eject-file.ts +0 -68
  76. package/src/bin/initialize-account-theme/copyBoilerplate.ts +0 -32
  77. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +0 -21
  78. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +0 -142
  79. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +0 -7
  80. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +0 -11
  81. package/src/bin/postinstall/index.ts +0 -1
  82. package/src/bin/shared/getLatestsSemVersionedTag.ts +0 -201
  83. package/src/bin/shared/promptKeycloakVersion.ts +0 -72
  84. package/src/bin/tools/OptionalIfCanBeUndefined.ts +0 -12
  85. package/src/bin/tools/crc32.ts +0 -73
  86. package/src/bin/tools/deflate.ts +0 -61
  87. package/src/bin/tools/isTrackedByGit.ts +0 -29
  88. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +0 -47
  89. package/src/bin/tools/octokit-addons/listTags.ts +0 -60
  90. package/src/bin/tools/tee.ts +0 -39
  91. package/src/bin/tools/trimIndent.ts +0 -49
  92. /package/bin/{postinstall/postinstall.d.ts → sync-extensions/sync-extension.d.ts} +0 -0
  93. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcContext.ts +0 -0
  94. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPage.tsx +0 -0
  95. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPageStory.tsx +0 -0
  96. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/i18n.ts +0 -0
@@ -1,9 +1,164 @@
1
1
  "use strict";
2
- exports.id = 615;
3
- exports.ids = [615];
2
+ exports.id = 355;
3
+ exports.ids = [355,786,288];
4
4
  exports.modules = {
5
5
 
6
- /***/ 61615:
6
+ /***/ 60355:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "command": () => (/* binding */ command)
12
+ /* harmony export */ });
13
+ /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72138);
14
+ /* harmony import */ var _shared_initializeSpa__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27288);
15
+ /* harmony import */ var _shared_exitIfUncommittedChanges__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22058);
16
+ /* harmony import */ var _update_kc_gen__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10786);
17
+
18
+
19
+
20
+
21
+ async function command(params) {
22
+ const { buildContext } = params;
23
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__/* .maybeDelegateCommandToCustomHandler */ .q)({
24
+ commandName: "initialize-admin-theme",
25
+ buildContext
26
+ });
27
+ if (hasBeenHandled) {
28
+ return;
29
+ }
30
+ (0,_shared_exitIfUncommittedChanges__WEBPACK_IMPORTED_MODULE_2__/* .exitIfUncommittedChanges */ .l)({
31
+ projectDirPath: buildContext.projectDirPath
32
+ });
33
+ await (0,_shared_initializeSpa__WEBPACK_IMPORTED_MODULE_1__.initializeSpa)({
34
+ themeType: "admin",
35
+ buildContext
36
+ });
37
+ await (0,_update_kc_gen__WEBPACK_IMPORTED_MODULE_3__.command)({
38
+ buildContext: Object.assign(Object.assign({}, buildContext), { implementedThemeTypes: Object.assign(Object.assign({}, buildContext.implementedThemeTypes), { admin: {
39
+ isImplemented: true
40
+ } }) })
41
+ });
42
+ }
43
+ //# sourceMappingURL=initialize-admin-theme.js.map
44
+
45
+ /***/ }),
46
+
47
+ /***/ 72138:
48
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
49
+
50
+
51
+ // EXPORTS
52
+ __webpack_require__.d(__webpack_exports__, {
53
+ "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
54
+ });
55
+
56
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
57
+ var esm_assert = __webpack_require__(29041);
58
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
59
+ var constants = __webpack_require__(173);
60
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
61
+
62
+
63
+ const BIN_NAME = "_keycloakify-custom-handler";
64
+ const NOT_IMPLEMENTED_EXIT_CODE = 78;
65
+ function readParams(params) {
66
+ const { apiVersion } = params;
67
+ assert(apiVersion === "v1");
68
+ const commandName = (() => {
69
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
70
+ assert(envValue !== undefined);
71
+ return envValue;
72
+ })();
73
+ const buildContext = (() => {
74
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
75
+ assert(envValue !== undefined);
76
+ return JSON.parse(envValue);
77
+ })();
78
+ return { commandName, buildContext };
79
+ }
80
+ //# sourceMappingURL=customHandler.js.map
81
+ // EXTERNAL MODULE: external "child_process"
82
+ var external_child_process_ = __webpack_require__(32081);
83
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
84
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
85
+ // EXTERNAL MODULE: external "fs"
86
+ var external_fs_ = __webpack_require__(57147);
87
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
88
+
89
+
90
+
91
+
92
+
93
+
94
+ (0,esm_assert/* assert */.h)();
95
+ function maybeDelegateCommandToCustomHandler(params) {
96
+ const { commandName, buildContext } = params;
97
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
98
+ if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
99
+ return { hasBeenHandled: false };
100
+ }
101
+ try {
102
+ external_child_process_.execSync(`npx ${BIN_NAME}`, {
103
+ stdio: "inherit",
104
+ env: Object.assign(Object.assign({}, process.env), { [constants/* CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME */._S.COMMAND_NAME]: commandName, [constants/* CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT */._S.BUILD_CONTEXT]: JSON.stringify(buildContext) })
105
+ });
106
+ }
107
+ catch (error) {
108
+ const status = error.status;
109
+ if (status === NOT_IMPLEMENTED_EXIT_CODE) {
110
+ return { hasBeenHandled: false };
111
+ }
112
+ process.exit(status);
113
+ }
114
+ return { hasBeenHandled: true };
115
+ }
116
+ //# sourceMappingURL=customHandler_delegate.js.map
117
+
118
+ /***/ }),
119
+
120
+ /***/ 22058:
121
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
122
+
123
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
124
+ /* harmony export */ "l": () => (/* binding */ exitIfUncommittedChanges)
125
+ /* harmony export */ });
126
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32081);
127
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);
128
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(78818);
129
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__);
130
+
131
+
132
+ function exitIfUncommittedChanges(params) {
133
+ const { projectDirPath } = params;
134
+ let hasUncommittedChanges = undefined;
135
+ try {
136
+ hasUncommittedChanges =
137
+ child_process__WEBPACK_IMPORTED_MODULE_0___default().execSync(`git status --porcelain`, {
138
+ cwd: projectDirPath
139
+ })
140
+ .toString()
141
+ .trim() !== "";
142
+ }
143
+ catch (_a) {
144
+ // Probably not a git repository
145
+ return;
146
+ }
147
+ if (!hasUncommittedChanges) {
148
+ return;
149
+ }
150
+ console.warn([
151
+ chalk__WEBPACK_IMPORTED_MODULE_1___default().red("Please commit or stash your changes before running this command.\n"),
152
+ "This command will modify your project's files so it's better to have a clean working directory",
153
+ "so that you can easily see what has been changed and revert if needed."
154
+ ].join(" "));
155
+ process.exit(-1);
156
+ }
157
+ //# sourceMappingURL=exitIfUncommittedChanges.js.map
158
+
159
+ /***/ }),
160
+
161
+ /***/ 27288:
7
162
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
163
 
9
164
  // ESM COMPAT FLAG
@@ -11,27 +166,25 @@ __webpack_require__.r(__webpack_exports__);
11
166
 
12
167
  // EXPORTS
13
168
  __webpack_require__.d(__webpack_exports__, {
14
- "command": () => (/* binding */ command)
169
+ "initializeSpa": () => (/* reexport */ initializeSpa)
15
170
  });
16
171
 
17
172
  // EXTERNAL MODULE: external "path"
18
173
  var external_path_ = __webpack_require__(71017);
19
174
  // EXTERNAL MODULE: external "fs"
20
175
  var external_fs_ = __webpack_require__(57147);
21
- // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
22
- var customHandler_delegate = __webpack_require__(72138);
23
176
  // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
24
177
  var assert = __webpack_require__(29041);
25
178
  // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
26
179
  var id = __webpack_require__(38469);
27
- ;// CONCATENATED MODULE: ./dist/bin/shared/addPostinstallScriptIfNotPresent.js
180
+ ;// CONCATENATED MODULE: ./dist/bin/shared/initializeSpa/addSyncExtensionsToPostinstallScript.js
28
181
 
29
182
 
30
183
  (0,assert/* assert */.h)();
31
- function addPostinstallScriptIfNotPresent(params) {
184
+ function addSyncExtensionsToPostinstallScript(params) {
32
185
  var _a;
33
186
  const { parsedPackageJson, buildContext } = params;
34
- const cmd_base = "keycloakify postinstall";
187
+ const cmd_base = "keycloakify sync-extensions";
35
188
  const projectCliOptionValue = (() => {
36
189
  const packageJsonDirPath = (0,external_path_.dirname)(buildContext.packageJsonFilePath);
37
190
  const relativePath = (0,external_path_.relative)(packageJsonDirPath, buildContext.projectDirPath);
@@ -56,7 +209,7 @@ function addPostinstallScriptIfNotPresent(params) {
56
209
  if (cmd_preexisting === undefined) {
57
210
  continue;
58
211
  }
59
- if (cmd_preexisting.includes(cmd_base)) {
212
+ if (!cmd_preexisting.includes(cmd_base)) {
60
213
  scripts[scriptName] = generateCmd({ cmd_preexisting });
61
214
  return;
62
215
  }
@@ -64,7 +217,7 @@ function addPostinstallScriptIfNotPresent(params) {
64
217
  }
65
218
  parsedPackageJson.scripts = Object.assign({ postinstall: generateCmd({ cmd_preexisting: undefined }) }, parsedPackageJson.scripts);
66
219
  }
67
- //# sourceMappingURL=addPostinstallScriptIfNotPresent.js.map
220
+ //# sourceMappingURL=addSyncExtensionsToPostinstallScript.js.map
68
221
  // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
69
222
  var runPrettier = __webpack_require__(48433);
70
223
  // EXTERNAL MODULE: ./dist/bin/tools/npmInstall.js
@@ -76,7 +229,7 @@ var lib = __webpack_require__(52300);
76
229
  // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
77
230
  var source = __webpack_require__(78818);
78
231
  var source_default = /*#__PURE__*/__webpack_require__.n(source);
79
- ;// CONCATENATED MODULE: ./dist/bin/initialize-admin-theme.js
232
+ ;// CONCATENATED MODULE: ./dist/bin/shared/initializeSpa/initializeSpa.js
80
233
 
81
234
 
82
235
 
@@ -87,22 +240,15 @@ var source_default = /*#__PURE__*/__webpack_require__.n(source);
87
240
 
88
241
 
89
242
 
90
-
91
- async function command(params) {
243
+ (0,assert/* assert */.h)();
244
+ async function initializeSpa(params) {
92
245
  var _a;
93
- const { buildContext } = params;
94
- const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
95
- commandName: "initialize-admin-theme",
96
- buildContext
97
- });
98
- if (hasBeenHandled) {
99
- return;
100
- }
246
+ const { themeType, buildContext } = params;
101
247
  {
102
- const adminThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "admin");
103
- if (external_fs_.existsSync(adminThemeSrcDirPath) &&
104
- external_fs_.readdirSync(adminThemeSrcDirPath).length > 0) {
105
- console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), adminThemeSrcDirPath)} directory in your project. Aborting.`));
248
+ const themeTypeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType);
249
+ if (external_fs_.existsSync(themeTypeSrcDirPath) &&
250
+ external_fs_.readdirSync(themeTypeSrcDirPath).length > 0) {
251
+ console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), themeTypeSrcDirPath)} directory in your project. Aborting.`));
106
252
  process.exit(-1);
107
253
  }
108
254
  }
@@ -121,7 +267,7 @@ async function command(params) {
121
267
  (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
122
268
  return parsedPackageJson;
123
269
  })();
124
- addPostinstallScriptIfNotPresent({
270
+ addSyncExtensionsToPostinstallScript({
125
271
  parsedPackageJson,
126
272
  buildContext
127
273
  });
@@ -137,7 +283,7 @@ async function command(params) {
137
283
  }
138
284
  return match[1];
139
285
  })();
140
- const moduleName = "@keycloakify/keycloak-admin-ui";
286
+ const moduleName = `@keycloakify/keycloak-${themeType}-ui`;
141
287
  const version = JSON.parse(external_child_process_.execSync(`npm show ${moduleName} versions --json`)
142
288
  .toString("utf8")
143
289
  .trim())
@@ -163,80 +309,10 @@ async function command(params) {
163
309
  packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
164
310
  });
165
311
  }
166
- //# sourceMappingURL=initialize-admin-theme.js.map
167
-
168
- /***/ }),
169
-
170
- /***/ 72138:
171
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
172
-
173
-
174
- // EXPORTS
175
- __webpack_require__.d(__webpack_exports__, {
176
- "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
177
- });
178
-
179
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
180
- var esm_assert = __webpack_require__(29041);
181
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
182
- var constants = __webpack_require__(173);
183
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
312
+ //# sourceMappingURL=initializeSpa.js.map
313
+ ;// CONCATENATED MODULE: ./dist/bin/shared/initializeSpa/index.js
184
314
 
185
-
186
- const BIN_NAME = "_keycloakify-custom-handler";
187
- const NOT_IMPLEMENTED_EXIT_CODE = 78;
188
- function readParams(params) {
189
- const { apiVersion } = params;
190
- assert(apiVersion === "v1");
191
- const commandName = (() => {
192
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
193
- assert(envValue !== undefined);
194
- return envValue;
195
- })();
196
- const buildContext = (() => {
197
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
198
- assert(envValue !== undefined);
199
- return JSON.parse(envValue);
200
- })();
201
- return { commandName, buildContext };
202
- }
203
- //# sourceMappingURL=customHandler.js.map
204
- // EXTERNAL MODULE: external "child_process"
205
- var external_child_process_ = __webpack_require__(32081);
206
- // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
207
- var tools_nodeModulesBinDirPath = __webpack_require__(73776);
208
- // EXTERNAL MODULE: external "fs"
209
- var external_fs_ = __webpack_require__(57147);
210
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
211
-
212
-
213
-
214
-
215
-
216
-
217
- (0,esm_assert/* assert */.h)();
218
- function maybeDelegateCommandToCustomHandler(params) {
219
- const { commandName, buildContext } = params;
220
- const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
221
- if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
222
- return { hasBeenHandled: false };
223
- }
224
- try {
225
- external_child_process_.execSync(`npx ${BIN_NAME}`, {
226
- stdio: "inherit",
227
- env: Object.assign(Object.assign({}, process.env), { [constants/* CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME */._S.COMMAND_NAME]: commandName, [constants/* CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT */._S.BUILD_CONTEXT]: JSON.stringify(buildContext) })
228
- });
229
- }
230
- catch (error) {
231
- const status = error.status;
232
- if (status === NOT_IMPLEMENTED_EXIT_CODE) {
233
- return { hasBeenHandled: false };
234
- }
235
- process.exit(status);
236
- }
237
- return { hasBeenHandled: true };
238
- }
239
- //# sourceMappingURL=customHandler_delegate.js.map
315
+ //# sourceMappingURL=index.js.map
240
316
 
241
317
  /***/ }),
242
318
 
@@ -325,6 +401,30 @@ var SemVer;
325
401
 
326
402
  /***/ }),
327
403
 
404
+ /***/ 43765:
405
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
406
+
407
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
408
+ /* harmony export */ "o": () => (/* binding */ existsAsync)
409
+ /* harmony export */ });
410
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
411
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
412
+
413
+ async function existsAsync(path) {
414
+ try {
415
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
416
+ return true;
417
+ }
418
+ catch (error) {
419
+ if (error.code === "ENOENT")
420
+ return false;
421
+ throw error;
422
+ }
423
+ }
424
+ //# sourceMappingURL=fs.existsAsync.js.map
425
+
426
+ /***/ }),
427
+
328
428
  /***/ 89693:
329
429
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
330
430
 
@@ -510,7 +610,7 @@ async function runPackageManagerInstall(params) {
510
610
  });
511
611
  child.stdout.on("data", data => process.stdout.write(data));
512
612
  child.stderr.on("data", data => {
513
- if (data.toString("utf8").includes("has unmet peer dependency")) {
613
+ if (data.toString("utf8").includes("peer dependency")) {
514
614
  return;
515
615
  }
516
616
  process.stderr.write(data);
@@ -861,6 +961,157 @@ async function runPrettier(params) {
861
961
 
862
962
  /***/ }),
863
963
 
964
+ /***/ 10786:
965
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
966
+
967
+ __webpack_require__.r(__webpack_exports__);
968
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
969
+ /* harmony export */ "command": () => (/* binding */ command)
970
+ /* harmony export */ });
971
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
972
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
973
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
974
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
975
+ /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43765);
976
+ /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72138);
977
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6113);
978
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_4__);
979
+ /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48433);
980
+
981
+
982
+
983
+
984
+
985
+
986
+ async function command(params) {
987
+ const { buildContext } = params;
988
+ run_copy_assets_to_public: {
989
+ if (buildContext.bundler !== "webpack") {
990
+ break run_copy_assets_to_public;
991
+ }
992
+ const { command } = await __webpack_require__.e(/* import() */ 658).then(__webpack_require__.bind(__webpack_require__, 18040));
993
+ await command({ buildContext });
994
+ }
995
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
996
+ commandName: "update-kc-gen",
997
+ buildContext
998
+ });
999
+ if (hasBeenHandled) {
1000
+ return;
1001
+ }
1002
+ const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
1003
+ const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
1004
+ const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
1005
+ const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
1006
+ let newContent = [
1007
+ ``,
1008
+ `/* eslint-disable */`,
1009
+ ``,
1010
+ `// @ts-nocheck`,
1011
+ ``,
1012
+ `// noinspection JSUnusedGlobalSymbols`,
1013
+ ``,
1014
+ `import { lazy, Suspense, type ReactNode } from "react";`,
1015
+ ``,
1016
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
1017
+ ``,
1018
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
1019
+ ``,
1020
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
1021
+ ``,
1022
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
1023
+ ``,
1024
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
1025
+ ``,
1026
+ `/**`,
1027
+ ` * NOTE: Do not import this type except maybe in your entrypoint. `,
1028
+ ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
1029
+ ` * Depending on the theme type you are working on.`,
1030
+ ` */`,
1031
+ `export type KcContext =`,
1032
+ hasLoginTheme && ` | import("./login/KcContext").KcContext`,
1033
+ hasAccountTheme && ` | import("./account/KcContext").KcContext`,
1034
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
1035
+ ` ;`,
1036
+ ``,
1037
+ `declare global {`,
1038
+ ` interface Window {`,
1039
+ ` kcContext?: KcContext;`,
1040
+ ` }`,
1041
+ `}`,
1042
+ ``,
1043
+ hasLoginTheme &&
1044
+ `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
1045
+ hasAccountTheme &&
1046
+ `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
1047
+ hasAdminTheme &&
1048
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
1049
+ ``,
1050
+ `export function KcPage(`,
1051
+ ` props: {`,
1052
+ ` kcContext: KcContext;`,
1053
+ ` fallback?: ReactNode;`,
1054
+ ` }`,
1055
+ `) {`,
1056
+ ` const { kcContext, fallback } = props;`,
1057
+ ` return (`,
1058
+ ` <Suspense fallback={fallback}>`,
1059
+ ` {(() => {`,
1060
+ ` switch (kcContext.themeType) {`,
1061
+ hasLoginTheme &&
1062
+ ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
1063
+ hasAccountTheme &&
1064
+ ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
1065
+ hasAdminTheme &&
1066
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
1067
+ ` }`,
1068
+ ` })()}`,
1069
+ ` </Suspense>`,
1070
+ ` );`,
1071
+ `}`,
1072
+ ``
1073
+ ]
1074
+ .filter(item => typeof item === "string")
1075
+ .join("\n");
1076
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
1077
+ skip_if_no_changes: {
1078
+ if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
1079
+ break skip_if_no_changes;
1080
+ }
1081
+ const currentContent = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
1082
+ if (!currentContent.includes(hash)) {
1083
+ break skip_if_no_changes;
1084
+ }
1085
+ return;
1086
+ }
1087
+ newContent = [
1088
+ `// This file is auto-generated by the \`update-kc-gen\` command. Do not edit it manually.`,
1089
+ `// Hash: ${hash}`,
1090
+ ``,
1091
+ newContent
1092
+ ].join("\n");
1093
+ format: {
1094
+ if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .getIsPrettierAvailable */ .MT)())) {
1095
+ break format;
1096
+ }
1097
+ newContent = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .runPrettier */ .eY)({
1098
+ filePath,
1099
+ sourceCode: newContent
1100
+ });
1101
+ }
1102
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from(newContent, "utf8"));
1103
+ delete_legacy_file: {
1104
+ const legacyFilePath = filePath.replace(/tsx$/, "ts");
1105
+ if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(legacyFilePath))) {
1106
+ break delete_legacy_file;
1107
+ }
1108
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.unlink(legacyFilePath);
1109
+ }
1110
+ }
1111
+ //# sourceMappingURL=update-kc-gen.js.map
1112
+
1113
+ /***/ }),
1114
+
864
1115
  /***/ 50689:
865
1116
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
866
1117