keycloakify 11.3.19 → 11.3.21

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 (67) hide show
  1. package/bin/124.index.js +676 -0
  2. package/bin/356.index.js +700 -0
  3. package/bin/40.index.js +41 -21
  4. package/bin/{903.index.js → 450.index.js} +2 -680
  5. package/bin/453.index.js +143 -85
  6. package/bin/573.index.js +51 -24
  7. package/bin/{599.index.js → 735.index.js} +438 -121
  8. package/bin/786.index.js +129 -78
  9. package/bin/805.index.js +674 -0
  10. package/bin/854.index.js +68 -0
  11. package/bin/{780.index.js → 921.index.js} +168 -109
  12. package/bin/932.index.js +41 -21
  13. package/bin/97.index.js +125 -75
  14. package/bin/eject-file.d.ts +7 -0
  15. package/bin/keycloakify/generateResources/generateMessageProperties.d.ts +1 -1
  16. package/bin/keycloakify/generateResources/readFieldNameUsage.d.ts +1 -1
  17. package/bin/main.js +70 -7
  18. package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
  19. package/bin/postinstall/index.d.ts +1 -0
  20. package/bin/postinstall/installUiModulesPeerDependencies.d.ts +11 -0
  21. package/bin/postinstall/managedGitignoreFile.d.ts +14 -0
  22. package/bin/postinstall/postinstall.d.ts +4 -0
  23. package/bin/postinstall/uiModuleMeta.d.ts +21 -0
  24. package/bin/shared/buildContext.d.ts +3 -0
  25. package/bin/shared/constants.d.ts +2 -1
  26. package/bin/shared/constants.js +2 -1
  27. package/bin/shared/constants.js.map +1 -1
  28. package/bin/shared/customHandler.d.ts +1 -1
  29. package/bin/shared/customHandler.js.map +1 -1
  30. package/bin/shared/exitIfUncommittedChanges.d.ts +3 -0
  31. package/bin/tools/crawlAsync.d.ts +6 -0
  32. package/bin/tools/getInstalledModuleDirPath.d.ts +5 -0
  33. package/bin/tools/listInstalledModules.d.ts +12 -0
  34. package/bin/tools/nodeModulesBinDirPath.d.ts +1 -0
  35. package/bin/tools/runPrettier.d.ts +17 -0
  36. package/package.json +34 -6
  37. package/src/bin/add-story.ts +28 -10
  38. package/src/bin/eject-file.ts +68 -0
  39. package/src/bin/eject-page.ts +51 -31
  40. package/src/bin/initialize-account-theme/initialize-account-theme.ts +4 -32
  41. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +2 -16
  42. package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +1 -1
  43. package/src/bin/keycloakify/generateResources/generateResources.ts +58 -26
  44. package/src/bin/keycloakify/generateResources/readFieldNameUsage.ts +1 -1
  45. package/src/bin/main.ts +50 -0
  46. package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +73 -0
  47. package/src/bin/postinstall/index.ts +1 -0
  48. package/src/bin/postinstall/installUiModulesPeerDependencies.ts +158 -0
  49. package/src/bin/postinstall/managedGitignoreFile.ts +136 -0
  50. package/src/bin/postinstall/postinstall.ts +79 -0
  51. package/src/bin/postinstall/uiModuleMeta.ts +309 -0
  52. package/src/bin/shared/buildContext.ts +11 -5
  53. package/src/bin/shared/constants.ts +3 -1
  54. package/src/bin/shared/customHandler.ts +1 -0
  55. package/src/bin/shared/customHandler_delegate.ts +2 -27
  56. package/src/bin/shared/exitIfUncommittedChanges.ts +36 -0
  57. package/src/bin/tools/crawlAsync.ts +51 -0
  58. package/src/bin/tools/getInstalledModuleDirPath.ts +51 -0
  59. package/src/bin/tools/listInstalledModules.ts +131 -0
  60. package/src/bin/tools/nodeModulesBinDirPath.ts +38 -0
  61. package/src/bin/tools/npmInstall.ts +411 -15
  62. package/src/bin/tools/readThisNpmPackageVersion.ts +8 -0
  63. package/src/bin/tools/runPrettier.ts +106 -0
  64. package/src/bin/update-kc-gen.ts +28 -17
  65. package/vite-plugin/index.js +9237 -9163
  66. package/bin/tools/runFormat.d.ts +0 -3
  67. package/src/bin/tools/runFormat.ts +0 -76
package/bin/786.index.js CHANGED
@@ -39,8 +39,8 @@ function readParams(params) {
39
39
  //# sourceMappingURL=customHandler.js.map
40
40
  // EXTERNAL MODULE: external "child_process"
41
41
  var external_child_process_ = __webpack_require__(32081);
42
- // EXTERNAL MODULE: external "path"
43
- var external_path_ = __webpack_require__(71017);
42
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
43
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
44
44
  // EXTERNAL MODULE: external "fs"
45
45
  var external_fs_ = __webpack_require__(57147);
46
46
  ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
@@ -53,25 +53,7 @@ var external_fs_ = __webpack_require__(57147);
53
53
  (0,esm_assert/* assert */.h)();
54
54
  function maybeDelegateCommandToCustomHandler(params) {
55
55
  const { commandName, buildContext } = params;
56
- const nodeModulesBinDirPath = (() => {
57
- const binPath = process.argv[1];
58
- const segments = [".bin"];
59
- let foundNodeModules = false;
60
- for (const segment of binPath.split(external_path_.sep).reverse()) {
61
- skip_segment: {
62
- if (foundNodeModules) {
63
- break skip_segment;
64
- }
65
- if (segment === "node_modules") {
66
- foundNodeModules = true;
67
- break skip_segment;
68
- }
69
- continue;
70
- }
71
- segments.unshift(segment);
72
- }
73
- return segments.join(external_path_.sep);
74
- })();
56
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
75
57
  if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
76
58
  return { hasBeenHandled: false };
77
59
  }
@@ -118,25 +100,63 @@ async function existsAsync(path) {
118
100
 
119
101
  /***/ }),
120
102
 
121
- /***/ 22577:
103
+ /***/ 73776:
104
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
105
+
106
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
107
+ /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
108
+ /* harmony export */ });
109
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
110
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
111
+
112
+ let cache = undefined;
113
+ function getNodeModulesBinDirPath() {
114
+ if (cache !== undefined) {
115
+ return cache;
116
+ }
117
+ const binPath = process.argv[1];
118
+ const segments = [".bin"];
119
+ let foundNodeModules = false;
120
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
121
+ skip_segment: {
122
+ if (foundNodeModules) {
123
+ break skip_segment;
124
+ }
125
+ if (segment === "node_modules") {
126
+ foundNodeModules = true;
127
+ break skip_segment;
128
+ }
129
+ continue;
130
+ }
131
+ segments.unshift(segment);
132
+ }
133
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
134
+ cache = nodeModulesBinDirPath;
135
+ return nodeModulesBinDirPath;
136
+ }
137
+ //# sourceMappingURL=nodeModulesBinDirPath.js.map
138
+
139
+ /***/ }),
140
+
141
+ /***/ 48433:
122
142
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
123
143
 
124
144
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
125
- /* harmony export */ "S": () => (/* binding */ runFormat)
145
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
146
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
147
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
126
148
  /* harmony export */ });
127
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
128
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
149
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
129
150
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
130
151
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
131
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
132
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78818);
133
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_3__);
134
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
135
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52300);
136
- /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16453);
137
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(32081);
138
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_5__);
139
-
152
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
153
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
154
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38469);
155
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
156
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
157
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
158
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
159
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
140
160
 
141
161
 
142
162
 
@@ -144,46 +164,62 @@ async function existsAsync(path) {
144
164
 
145
165
 
146
166
 
147
- function runFormat(params) {
148
- const { packageJsonFilePath } = params;
149
- const parsedPackageJson = (() => {
150
- const zParsedPackageJson = (() => {
151
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_6__.z.object({
152
- scripts: zod__WEBPACK_IMPORTED_MODULE_6__.z.record(zod__WEBPACK_IMPORTED_MODULE_6__.z.string()).optional()
153
- });
154
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
155
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(zTargetType);
156
- })();
157
- const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString("utf8"));
158
- zParsedPackageJson.parse(parsedPackageJson);
159
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_4__.is)(parsedPackageJson));
160
- return parsedPackageJson;
161
- })();
162
- const { scripts } = parsedPackageJson;
163
- if (scripts === undefined) {
164
- return;
167
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
168
+ async function getIsPrettierAvailable() {
169
+ var _a;
170
+ if (getIsPrettierAvailable.cache !== undefined) {
171
+ return getIsPrettierAvailable.cache;
165
172
  }
166
- const scriptKeys = Object.keys(scripts);
167
- const scriptNames = scriptKeys.filter(scriptKey => scriptKey.trim().match(/^(lint|format)/));
168
- for (const scriptName of scriptNames) {
169
- if (!(scriptName in scripts)) {
170
- continue;
171
- }
172
- const command = `npm run ${scriptName}`;
173
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().grey(`$ ${command}`));
174
- try {
175
- child_process__WEBPACK_IMPORTED_MODULE_5__.execSync(`npm run ${scriptName}`, {
176
- stdio: "inherit",
177
- cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
178
- });
173
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
174
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
175
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
176
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
177
+ getIsPrettierAvailable.cache = isPrettierAvailable;
178
+ return isPrettierAvailable;
179
+ }
180
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
181
+ async function getPrettier() {
182
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
183
+ if (getPrettier.cache !== undefined) {
184
+ return getPrettier.cache;
185
+ }
186
+ const prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
187
+ const configHash = await (async () => {
188
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
189
+ if (configFilePath === null) {
190
+ return "";
179
191
  }
180
- catch (_a) {
181
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`\`${command}\` failed, it does not matter, please format your code manually, continuing...`));
192
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
193
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
194
+ })();
195
+ const prettierAndConfig = {
196
+ prettier,
197
+ configHash
198
+ };
199
+ getPrettier.cache = prettierAndConfig;
200
+ return prettierAndConfig;
201
+ }
202
+ async function runPrettier(params) {
203
+ const { sourceCode, filePath } = params;
204
+ let formattedSourceCode;
205
+ try {
206
+ const { prettier } = await getPrettier();
207
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
208
+ resolveConfig: true
209
+ });
210
+ if (ignored) {
211
+ return sourceCode;
182
212
  }
183
- return;
213
+ const config = await prettier.resolveConfig(filePath);
214
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
215
+ }
216
+ catch (error) {
217
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
218
+ throw error;
184
219
  }
220
+ return formattedSourceCode;
185
221
  }
186
- //# sourceMappingURL=runFormat.js.map
222
+ //# sourceMappingURL=runPrettier.js.map
187
223
 
188
224
  /***/ }),
189
225
 
@@ -200,9 +236,9 @@ __webpack_require__.r(__webpack_exports__);
200
236
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
201
237
  /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43765);
202
238
  /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72138);
203
- /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22577);
204
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
205
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
239
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6113);
240
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_4__);
241
+ /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48433);
206
242
 
207
243
 
208
244
 
@@ -218,10 +254,11 @@ async function command(params) {
218
254
  if (hasBeenHandled) {
219
255
  return;
220
256
  }
221
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
257
+ const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
222
258
  const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
223
259
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
224
- const newContent = [
260
+ const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
261
+ let newContent = [
225
262
  ``,
226
263
  `/* eslint-disable */`,
227
264
  ``,
@@ -244,6 +281,7 @@ async function command(params) {
244
281
  `type KcContext =`,
245
282
  hasLoginTheme && ` | import("./login/KcContext").KcContext`,
246
283
  hasAccountTheme && ` | import("./account/KcContext").KcContext`,
284
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
247
285
  ` ;`,
248
286
  ``,
249
287
  `declare global {`,
@@ -256,6 +294,8 @@ async function command(params) {
256
294
  `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
257
295
  hasAccountTheme &&
258
296
  `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
297
+ hasAdminTheme &&
298
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
259
299
  ``,
260
300
  `export function KcPage(`,
261
301
  ` props: {`,
@@ -272,6 +312,8 @@ async function command(params) {
272
312
  ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
273
313
  hasAccountTheme &&
274
314
  ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
315
+ hasAdminTheme &&
316
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
275
317
  ` }`,
276
318
  ` })()}`,
277
319
  ` </Suspense>`,
@@ -281,7 +323,7 @@ async function command(params) {
281
323
  ]
282
324
  .filter(item => typeof item === "string")
283
325
  .join("\n");
284
- const hash = crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(newContent).digest("hex");
326
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
285
327
  skip_if_no_changes: {
286
328
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
287
329
  break skip_if_no_changes;
@@ -292,13 +334,22 @@ async function command(params) {
292
334
  }
293
335
  return;
294
336
  }
295
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from([
337
+ newContent = [
296
338
  `// This file is auto-generated by the \`update-kc-gen\` command. Do not edit it manually.`,
297
339
  `// Hash: ${hash}`,
298
340
  ``,
299
341
  newContent
300
- ].join("\n"), "utf8"));
301
- (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_4__/* .runFormat */ .S)({ packageJsonFilePath: buildContext.packageJsonFilePath });
342
+ ].join("\n");
343
+ format: {
344
+ if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .getIsPrettierAvailable */ .MT)())) {
345
+ break format;
346
+ }
347
+ newContent = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .runPrettier */ .eY)({
348
+ filePath,
349
+ sourceCode: newContent
350
+ });
351
+ }
352
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from(newContent, "utf8"));
302
353
  delete_legacy_file: {
303
354
  const legacyFilePath = filePath.replace(/tsx$/, "ts");
304
355
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(legacyFilePath))) {