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
package/bin/300.index.js DELETED
@@ -1,770 +0,0 @@
1
- "use strict";
2
- exports.id = 300;
3
- exports.ids = [300];
4
- exports.modules = {
5
-
6
- /***/ 6385:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "X": () => (/* binding */ getUiModuleFileSourceCodeReadyToBeCopied)
11
- /* harmony export */ });
12
- /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48433);
13
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73292);
14
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
15
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71017);
16
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
17
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
18
- /* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(173);
19
-
20
-
21
-
22
-
23
-
24
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)();
25
- async function getUiModuleFileSourceCodeReadyToBeCopied(params) {
26
- const { buildContext, uiModuleDirPath, fileRelativePath, isForEjection, uiModuleName, uiModuleVersion } = params;
27
- let sourceCode = (await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(uiModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, fileRelativePath))).toString("utf8");
28
- sourceCode = addCommentToSourceCode({
29
- sourceCode,
30
- fileRelativePath,
31
- commentLines: isForEjection
32
- ? [`This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`]
33
- : [
34
- `WARNING: Before modifying this file run the following command:`,
35
- ``,
36
- `$ npx keycloakify eject-file --file '${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}'`,
37
- ``,
38
- `This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
39
- `This file has been copied over to your repo by your postinstall script: \`npx keycloakify postinstall\``
40
- ]
41
- });
42
- const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
43
- format: {
44
- if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
45
- break format;
46
- }
47
- sourceCode = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .runPrettier */ .eY)({
48
- filePath: destFilePath,
49
- sourceCode
50
- });
51
- }
52
- return Buffer.from(sourceCode, "utf8");
53
- }
54
- function addCommentToSourceCode(params) {
55
- const { sourceCode, fileRelativePath, commentLines } = params;
56
- const toResult = (comment) => {
57
- return [comment, ``, sourceCode].join("\n");
58
- };
59
- for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
60
- if (!fileRelativePath.endsWith(ext)) {
61
- continue;
62
- }
63
- return toResult([`/**`, ...commentLines.map(line => ` * ${line}`), ` */`].join("\n"));
64
- }
65
- if (fileRelativePath.endsWith(".properties")) {
66
- return toResult(commentLines.map(line => `# ${line}`).join("\n"));
67
- }
68
- if (fileRelativePath.endsWith(".html") || fileRelativePath.endsWith(".svg")) {
69
- const comment = [
70
- `<!--`,
71
- ...commentLines.map(line => ` ${line.replace("--file", "-f").replace("Before modifying", "Before modifying or replacing")}`),
72
- `-->`
73
- ].join("\n");
74
- if (fileRelativePath.endsWith(".html") && sourceCode.trim().startsWith("<!")) {
75
- const [first, ...rest] = sourceCode.split(">");
76
- const last = rest.join(">");
77
- return [`${first}>`, comment, last].join("\n");
78
- }
79
- if (fileRelativePath.endsWith(".svg") && sourceCode.trim().startsWith("<?")) {
80
- const [first, ...rest] = sourceCode.split("?>");
81
- const last = rest.join("?>");
82
- return [`${first}?>`, comment, last].join("\n");
83
- }
84
- return toResult(comment);
85
- }
86
- return sourceCode;
87
- }
88
- //# sourceMappingURL=getUiModuleFileSourceCodeReadyToBeCopied.js.map
89
-
90
- /***/ }),
91
-
92
- /***/ 36843:
93
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
94
-
95
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
96
- /* harmony export */ "Y": () => (/* binding */ writeManagedGitignoreFile),
97
- /* harmony export */ "w": () => (/* binding */ readManagedGitignoreFile)
98
- /* harmony export */ });
99
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
100
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
101
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
102
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
103
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
104
- /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
105
- /* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84794);
106
-
107
-
108
-
109
-
110
-
111
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
112
- const DELIMITER_START = `# === Ejected files start ===`;
113
- const DELIMITER_END = `# === Ejected files end =====`;
114
- async function writeManagedGitignoreFile(params) {
115
- const { buildContext, uiModuleMetas, ejectedFilesRelativePaths } = params;
116
- if (uiModuleMetas.length === 0) {
117
- return;
118
- }
119
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, ".gitignore");
120
- const content_new = Buffer.from([
121
- `# This file is managed by Keycloakify, do not edit it manually.`,
122
- ``,
123
- DELIMITER_START,
124
- ...ejectedFilesRelativePaths
125
- .map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
126
- .map(line => `# ${line}`),
127
- DELIMITER_END,
128
- ``,
129
- ...uiModuleMetas
130
- .map(uiModuleMeta => [
131
- `# === ${uiModuleMeta.moduleName} v${uiModuleMeta.version} ===`,
132
- ...uiModuleMeta.files
133
- .map(({ fileRelativePath }) => fileRelativePath)
134
- .filter(fileRelativePath => !ejectedFilesRelativePaths.includes(fileRelativePath))
135
- .map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`),
136
- ``
137
- ])
138
- .flat()
139
- ].join("\n"), "utf8");
140
- const content_current = await (async () => {
141
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
142
- return undefined;
143
- }
144
- return await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath);
145
- })();
146
- if (content_current !== undefined && content_current.equals(content_new)) {
147
- return;
148
- }
149
- create_dir: {
150
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
151
- if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
152
- break create_dir;
153
- }
154
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.mkdir(dirPath, { recursive: true });
155
- }
156
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
157
- }
158
- async function readManagedGitignoreFile(params) {
159
- const { buildContext } = params;
160
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, ".gitignore");
161
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
162
- return { ejectedFilesRelativePaths: [] };
163
- }
164
- const contentStr = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
165
- const payload = (() => {
166
- const index_start = contentStr.indexOf(DELIMITER_START);
167
- const index_end = contentStr.indexOf(DELIMITER_END);
168
- if (index_start === -1 || index_end === -1) {
169
- return undefined;
170
- }
171
- return contentStr.slice(index_start + DELIMITER_START.length, index_end).trim();
172
- })();
173
- if (payload === undefined) {
174
- return { ejectedFilesRelativePaths: [] };
175
- }
176
- const ejectedFilesRelativePaths = payload
177
- .split("\n")
178
- .map(line => line.trim())
179
- .map(line => line.replace(/^# /, ""))
180
- .filter(line => line !== "")
181
- .map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
182
- cwd: buildContext.themeSrcDirPath,
183
- pathIsh: line
184
- }))
185
- .map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath));
186
- return { ejectedFilesRelativePaths };
187
- }
188
- //# sourceMappingURL=managedGitignoreFile.js.map
189
-
190
- /***/ }),
191
-
192
- /***/ 58644:
193
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
194
-
195
-
196
- // EXPORTS
197
- __webpack_require__.d(__webpack_exports__, {
198
- "x": () => (/* binding */ computeHash),
199
- "j": () => (/* binding */ getUiModuleMetas)
200
- });
201
-
202
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
203
- var assert = __webpack_require__(29041);
204
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
205
- var id = __webpack_require__(38469);
206
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
207
- var lib = __webpack_require__(52300);
208
- // EXTERNAL MODULE: external "path"
209
- var external_path_ = __webpack_require__(71017);
210
- // EXTERNAL MODULE: external "fs/promises"
211
- var promises_ = __webpack_require__(73292);
212
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
213
- var fs_existsAsync = __webpack_require__(43765);
214
- // EXTERNAL MODULE: ./dist/bin/tools/getInstalledModuleDirPath.js
215
- var getInstalledModuleDirPath = __webpack_require__(21022);
216
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
217
- var exclude = __webpack_require__(83101);
218
- ;// CONCATENATED MODULE: ./dist/bin/tools/listInstalledModules.js
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
- async function listInstalledModules(params) {
227
- const { packageJsonFilePath, projectDirPath, filter } = params;
228
- const parsedPackageJson = await readPackageJsonDependencies({
229
- packageJsonFilePath
230
- });
231
- const uiModuleNames = [parsedPackageJson.dependencies, parsedPackageJson.devDependencies]
232
- .filter((0,exclude/* exclude */.D)(undefined))
233
- .map(obj => Object.keys(obj))
234
- .flat()
235
- .filter(moduleName => filter({ moduleName }));
236
- const result = await Promise.all(uiModuleNames.map(async (moduleName) => {
237
- const dirPath = await (0,getInstalledModuleDirPath/* getInstalledModuleDirPath */.p)({
238
- moduleName,
239
- packageJsonDirPath: (0,external_path_.dirname)(packageJsonFilePath),
240
- projectDirPath
241
- });
242
- const { version, peerDependencies } = await readPackageJsonVersionAndPeerDependencies({
243
- packageJsonFilePath: (0,external_path_.join)(dirPath, "package.json")
244
- });
245
- return { moduleName, version, peerDependencies, dirPath };
246
- }));
247
- return result;
248
- }
249
- const { readPackageJsonDependencies } = (() => {
250
- const zParsedPackageJson = (() => {
251
- const zTargetType = lib.z.object({
252
- dependencies: lib.z.record(lib.z.string()).optional(),
253
- devDependencies: lib.z.record(lib.z.string()).optional()
254
- });
255
- (0,assert/* assert */.h)();
256
- return (0,id.id)(zTargetType);
257
- })();
258
- async function readPackageJsonDependencies(params) {
259
- const { packageJsonFilePath } = params;
260
- const parsedPackageJson = JSON.parse((await promises_.readFile(packageJsonFilePath)).toString("utf8"));
261
- zParsedPackageJson.parse(parsedPackageJson);
262
- (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
263
- return parsedPackageJson;
264
- }
265
- return { readPackageJsonDependencies };
266
- })();
267
- const { readPackageJsonVersionAndPeerDependencies } = (() => {
268
- const zParsedPackageJson = (() => {
269
- const zTargetType = lib.z.object({
270
- version: lib.z.string(),
271
- peerDependencies: lib.z.record(lib.z.string()).optional()
272
- });
273
- (0,assert/* assert */.h)();
274
- return (0,id.id)(zTargetType);
275
- })();
276
- async function readPackageJsonVersionAndPeerDependencies(params) {
277
- var _a;
278
- const { packageJsonFilePath } = params;
279
- const parsedPackageJson = JSON.parse((await promises_.readFile(packageJsonFilePath)).toString("utf8"));
280
- zParsedPackageJson.parse(parsedPackageJson);
281
- (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
282
- return {
283
- version: parsedPackageJson.version,
284
- peerDependencies: (_a = parsedPackageJson.peerDependencies) !== null && _a !== void 0 ? _a : {}
285
- };
286
- }
287
- return { readPackageJsonVersionAndPeerDependencies };
288
- })();
289
- //# sourceMappingURL=listInstalledModules.js.map
290
- ;// CONCATENATED MODULE: ./dist/bin/tools/crawlAsync.js
291
-
292
-
293
-
294
- /** List all files in a given directory return paths relative to the dir_path */
295
- async function crawlAsync(params) {
296
- const { dirPath, returnedPathsType, onFileFound } = params;
297
- await crawlAsyncRec({
298
- dirPath,
299
- onFileFound: async ({ filePath }) => {
300
- switch (returnedPathsType) {
301
- case "absolute":
302
- await onFileFound(filePath);
303
- return;
304
- case "relative to dirPath":
305
- await onFileFound((0,external_path_.relative)(dirPath, filePath));
306
- return;
307
- }
308
- (0,assert/* assert */.h)();
309
- }
310
- });
311
- }
312
- async function crawlAsyncRec(params) {
313
- const { dirPath, onFileFound } = params;
314
- await Promise.all((await promises_.readdir(dirPath)).map(async (basename) => {
315
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
316
- const isDirectory = await promises_.lstat(fileOrDirPath)
317
- .then(stat => stat.isDirectory());
318
- if (isDirectory) {
319
- await crawlAsyncRec({ dirPath: fileOrDirPath, onFileFound });
320
- return;
321
- }
322
- await onFileFound({ filePath: fileOrDirPath });
323
- }));
324
- }
325
- //# sourceMappingURL=crawlAsync.js.map
326
- // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
327
- var runPrettier = __webpack_require__(48433);
328
- // EXTERNAL MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
329
- var readThisNpmPackageVersion = __webpack_require__(64795);
330
- // EXTERNAL MODULE: ./dist/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.js
331
- var getUiModuleFileSourceCodeReadyToBeCopied = __webpack_require__(6385);
332
- // EXTERNAL MODULE: external "crypto"
333
- var external_crypto_ = __webpack_require__(6113);
334
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
335
- var constants = __webpack_require__(173);
336
- ;// CONCATENATED MODULE: ./node_modules/tsafe/esm/isAmong.mjs
337
- /** https://docs.tsafe.dev/isamong */
338
- function isAmong(names, value) {
339
- for (const name of names) {
340
- if (name === value) {
341
- return true;
342
- }
343
- }
344
- return false;
345
- }
346
-
347
-
348
- //# sourceMappingURL=isAmong.mjs.map
349
-
350
- ;// CONCATENATED MODULE: ./dist/bin/postinstall/uiModuleMeta.js
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
- const zUiModuleMeta = (() => {
367
- const zTargetType = lib.z.object({
368
- moduleName: lib.z.string(),
369
- version: lib.z.string(),
370
- files: lib.z.array(lib.z.object({
371
- fileRelativePath: lib.z.string(),
372
- hash: lib.z.string(),
373
- copyableFilePath: lib.z.string()
374
- })),
375
- peerDependencies: lib.z.record(lib.z.string())
376
- });
377
- (0,assert/* assert */.h)();
378
- return (0,id.id)(zTargetType);
379
- })();
380
- const zParsedCacheFile = (() => {
381
- const zTargetType = lib.z.object({
382
- keycloakifyVersion: lib.z.string(),
383
- prettierConfigHash: lib.z.union([lib.z.string(), lib.z["null"]()]),
384
- thisFilePath: lib.z.string(),
385
- uiModuleMetas: lib.z.array(zUiModuleMeta)
386
- });
387
- (0,assert/* assert */.h)();
388
- return (0,id.id)(zTargetType);
389
- })();
390
- const CACHE_FILE_RELATIVE_PATH = (0,external_path_.join)("ui-modules", "cache.json");
391
- (0,assert/* assert */.h)();
392
- async function getUiModuleMetas(params) {
393
- const { buildContext } = params;
394
- const cacheFilePath = (0,external_path_.join)(buildContext.cacheDirPath, CACHE_FILE_RELATIVE_PATH);
395
- const keycloakifyVersion = (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)();
396
- const prettierConfigHash = await (async () => {
397
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.MT)())) {
398
- return null;
399
- }
400
- const { configHash } = await (0,runPrettier/* getPrettier */.LG)();
401
- return configHash;
402
- })();
403
- const installedUiModules = await (async () => {
404
- const installedModulesWithKeycloakifyInTheName = await listInstalledModules({
405
- packageJsonFilePath: buildContext.packageJsonFilePath,
406
- projectDirPath: buildContext.packageJsonFilePath,
407
- filter: ({ moduleName }) => moduleName.includes("keycloakify") && moduleName !== "keycloakify"
408
- });
409
- return (await Promise.all(installedModulesWithKeycloakifyInTheName.map(async (entry) => {
410
- if (!(await (0,fs_existsAsync/* existsAsync */.o)((0,external_path_.join)(entry.dirPath, constants/* KEYCLOAK_THEME */.PC)))) {
411
- return undefined;
412
- }
413
- return entry;
414
- }))).filter((0,exclude/* exclude */.D)(undefined));
415
- })();
416
- const cacheContent = await (async () => {
417
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(cacheFilePath))) {
418
- return undefined;
419
- }
420
- return await promises_.readFile(cacheFilePath);
421
- })();
422
- const uiModuleMetas_cacheUpToDate = await (async () => {
423
- const parsedCacheFile = await (async () => {
424
- if (cacheContent === undefined) {
425
- return undefined;
426
- }
427
- const cacheContentStr = cacheContent.toString("utf8");
428
- let parsedCacheFile;
429
- try {
430
- parsedCacheFile = JSON.parse(cacheContentStr);
431
- }
432
- catch (_a) {
433
- return undefined;
434
- }
435
- try {
436
- zParsedCacheFile.parse(parsedCacheFile);
437
- }
438
- catch (_b) {
439
- return undefined;
440
- }
441
- (0,assert/* assert */.h)((0,assert.is)(parsedCacheFile));
442
- return parsedCacheFile;
443
- })();
444
- if (parsedCacheFile === undefined) {
445
- return [];
446
- }
447
- if (parsedCacheFile.keycloakifyVersion !== keycloakifyVersion) {
448
- return [];
449
- }
450
- if (parsedCacheFile.prettierConfigHash !== prettierConfigHash) {
451
- return [];
452
- }
453
- if (parsedCacheFile.thisFilePath !== cacheFilePath) {
454
- return [];
455
- }
456
- const uiModuleMetas_cacheUpToDate = parsedCacheFile.uiModuleMetas.filter(uiModuleMeta => {
457
- const correspondingInstalledUiModule = installedUiModules.find(installedUiModule => installedUiModule.moduleName === uiModuleMeta.moduleName);
458
- if (correspondingInstalledUiModule === undefined) {
459
- return false;
460
- }
461
- return correspondingInstalledUiModule.version === uiModuleMeta.version;
462
- });
463
- return uiModuleMetas_cacheUpToDate;
464
- })();
465
- const uiModuleMetas = await Promise.all(installedUiModules.map(async ({ moduleName, version, peerDependencies, dirPath }) => {
466
- use_cache: {
467
- const uiModuleMeta_cache = uiModuleMetas_cacheUpToDate.find(uiModuleMeta => uiModuleMeta.moduleName === moduleName);
468
- if (uiModuleMeta_cache === undefined) {
469
- break use_cache;
470
- }
471
- return uiModuleMeta_cache;
472
- }
473
- const files = [];
474
- {
475
- const srcDirPath = (0,external_path_.join)(dirPath, constants/* KEYCLOAK_THEME */.PC);
476
- await crawlAsync({
477
- dirPath: srcDirPath,
478
- returnedPathsType: "relative to dirPath",
479
- onFileFound: async (fileRelativePath) => {
480
- const sourceCode = await (0,getUiModuleFileSourceCodeReadyToBeCopied/* getUiModuleFileSourceCodeReadyToBeCopied */.X)({
481
- buildContext,
482
- fileRelativePath,
483
- isForEjection: false,
484
- uiModuleDirPath: dirPath,
485
- uiModuleName: moduleName,
486
- uiModuleVersion: version
487
- });
488
- const hash = computeHash(sourceCode);
489
- const copyableFilePath = (0,external_path_.join)((0,external_path_.dirname)(cacheFilePath), constants/* KEYCLOAK_THEME */.PC, fileRelativePath);
490
- {
491
- const dirPath = (0,external_path_.dirname)(copyableFilePath);
492
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
493
- await promises_.mkdir(dirPath, { recursive: true });
494
- }
495
- }
496
- promises_.writeFile(copyableFilePath, sourceCode);
497
- files.push({
498
- fileRelativePath,
499
- hash,
500
- copyableFilePath
501
- });
502
- }
503
- });
504
- }
505
- return (0,id.id)({
506
- moduleName,
507
- version,
508
- files,
509
- peerDependencies: Object.fromEntries(Object.entries(peerDependencies).filter(([moduleName]) => !isAmong(["react", "@types/react"], moduleName)))
510
- });
511
- }));
512
- update_cache: {
513
- const parsedCacheFile = (0,id.id)({
514
- keycloakifyVersion,
515
- prettierConfigHash,
516
- thisFilePath: cacheFilePath,
517
- uiModuleMetas
518
- });
519
- const cacheContent_new = Buffer.from(JSON.stringify(parsedCacheFile, null, 2), "utf8");
520
- if (cacheContent !== undefined && cacheContent_new.equals(cacheContent)) {
521
- break update_cache;
522
- }
523
- create_dir: {
524
- const dirPath = (0,external_path_.dirname)(cacheFilePath);
525
- if (await (0,fs_existsAsync/* existsAsync */.o)(dirPath)) {
526
- break create_dir;
527
- }
528
- await promises_.mkdir(dirPath, { recursive: true });
529
- }
530
- await promises_.writeFile(cacheFilePath, cacheContent_new);
531
- }
532
- return uiModuleMetas;
533
- }
534
- function computeHash(data) {
535
- return external_crypto_.createHash("sha256").update(data).digest("hex");
536
- }
537
- //# sourceMappingURL=uiModuleMeta.js.map
538
-
539
- /***/ }),
540
-
541
- /***/ 43765:
542
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
543
-
544
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
545
- /* harmony export */ "o": () => (/* binding */ existsAsync)
546
- /* harmony export */ });
547
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
548
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
549
-
550
- async function existsAsync(path) {
551
- try {
552
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
553
- return true;
554
- }
555
- catch (error) {
556
- if (error.code === "ENOENT")
557
- return false;
558
- throw error;
559
- }
560
- }
561
- //# sourceMappingURL=fs.existsAsync.js.map
562
-
563
- /***/ }),
564
-
565
- /***/ 21022:
566
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
567
-
568
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
569
- /* harmony export */ "p": () => (/* binding */ getInstalledModuleDirPath)
570
- /* harmony export */ });
571
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
572
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
573
- /* harmony import */ var _fs_existsAsync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(43765);
574
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(32081);
575
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_2__);
576
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
577
-
578
-
579
-
580
-
581
- async function getInstalledModuleDirPath(params) {
582
- const { moduleName, packageJsonDirPath, projectDirPath } = params;
583
- common_case: {
584
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(...[packageJsonDirPath, "node_modules", ...moduleName.split("/")]);
585
- if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_1__/* .existsAsync */ .o)(dirPath))) {
586
- break common_case;
587
- }
588
- return dirPath;
589
- }
590
- node_modules_at_root_case: {
591
- if (projectDirPath === packageJsonDirPath) {
592
- break node_modules_at_root_case;
593
- }
594
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(...[projectDirPath, "node_modules", ...moduleName.split("/")]);
595
- if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_1__/* .existsAsync */ .o)(dirPath))) {
596
- break node_modules_at_root_case;
597
- }
598
- return dirPath;
599
- }
600
- const dirPath = child_process__WEBPACK_IMPORTED_MODULE_2__.execSync(`npm list ${moduleName}`, {
601
- cwd: packageJsonDirPath
602
- })
603
- .toString("utf8")
604
- .trim();
605
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(dirPath !== "");
606
- return dirPath;
607
- }
608
- //# sourceMappingURL=getInstalledModuleDirPath.js.map
609
-
610
- /***/ }),
611
-
612
- /***/ 73776:
613
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
614
-
615
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
616
- /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
617
- /* harmony export */ });
618
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
619
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
620
-
621
- let cache = undefined;
622
- function getNodeModulesBinDirPath() {
623
- if (cache !== undefined) {
624
- return cache;
625
- }
626
- const binPath = process.argv[1];
627
- const segments = [".bin"];
628
- let foundNodeModules = false;
629
- for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
630
- skip_segment: {
631
- if (foundNodeModules) {
632
- break skip_segment;
633
- }
634
- if (segment === "node_modules") {
635
- foundNodeModules = true;
636
- break skip_segment;
637
- }
638
- continue;
639
- }
640
- segments.unshift(segment);
641
- }
642
- const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
643
- cache = nodeModulesBinDirPath;
644
- return nodeModulesBinDirPath;
645
- }
646
- //# sourceMappingURL=nodeModulesBinDirPath.js.map
647
-
648
- /***/ }),
649
-
650
- /***/ 48433:
651
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
652
-
653
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
654
- /* harmony export */ "LG": () => (/* binding */ getPrettier),
655
- /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
656
- /* harmony export */ "eY": () => (/* binding */ runPrettier)
657
- /* harmony export */ });
658
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
659
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
660
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
661
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
662
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
663
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
664
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
665
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
666
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
667
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
668
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
669
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
670
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
671
-
672
-
673
-
674
-
675
-
676
-
677
-
678
-
679
-
680
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
681
- async function getIsPrettierAvailable() {
682
- var _a;
683
- if (getIsPrettierAvailable.cache !== undefined) {
684
- return getIsPrettierAvailable.cache;
685
- }
686
- const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
687
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
688
- const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
689
- const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
690
- getIsPrettierAvailable.cache = isPrettierAvailable;
691
- return isPrettierAvailable;
692
- }
693
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
694
- async function getPrettier() {
695
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
696
- if (getPrettier.cache !== undefined) {
697
- return getPrettier.cache;
698
- }
699
- let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
700
- import_prettier: {
701
- // NOTE: When module is linked we want to make sure we import the correct version
702
- // of prettier, that is the one of the project, not the one of this repo.
703
- // So we do a sketchy eval to bypass ncc.
704
- // We make sure to only do that when linking, otherwise we import properly.
705
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
706
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
707
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
708
- break import_prettier;
709
- }
710
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
711
- }
712
- const configHash = await (async () => {
713
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
714
- if (configFilePath === null) {
715
- return "";
716
- }
717
- const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
718
- return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
719
- })();
720
- const prettierAndConfig = {
721
- prettier,
722
- configHash
723
- };
724
- getPrettier.cache = prettierAndConfig;
725
- return prettierAndConfig;
726
- }
727
- async function runPrettier(params) {
728
- const { sourceCode, filePath } = params;
729
- let formattedSourceCode;
730
- try {
731
- const { prettier } = await getPrettier();
732
- const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
733
- resolveConfig: true
734
- });
735
- if (ignored || inferredParser === null) {
736
- return sourceCode;
737
- }
738
- const config = await prettier.resolveConfig(filePath);
739
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
740
- }
741
- catch (error) {
742
- console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
743
- throw error;
744
- }
745
- return formattedSourceCode;
746
- }
747
- //# sourceMappingURL=runPrettier.js.map
748
-
749
- /***/ }),
750
-
751
- /***/ 76030:
752
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
753
-
754
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
755
- /* harmony export */ "r": () => (/* binding */ symToStr)
756
- /* harmony export */ });
757
- /** @see <https://docs.tsafe.dev/main/symtostr> */
758
- function symToStr(wrap) {
759
- // @ts-expect-error: We know better
760
- return Object.keys(wrap)[0];
761
- }
762
-
763
-
764
- //# sourceMappingURL=symToStr.mjs.map
765
-
766
-
767
- /***/ })
768
-
769
- };
770
- ;