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
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ exports.id = 854;
3
+ exports.ids = [854];
4
+ exports.modules = {
5
+
6
+ /***/ 85854:
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 _postinstall_getUiModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6385);
14
+ /* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84794);
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 _postinstall_uiModuleMeta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5038);
18
+ /* harmony import */ var _tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21022);
19
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(73292);
20
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_5__);
21
+ /* harmony import */ var _postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(36843);
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ async function command(params) {
30
+ const { buildContext, cliCommandOptions } = params;
31
+ const fileRelativePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.relative)(buildContext.themeSrcDirPath, (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_1__/* .getAbsoluteAndInOsFormatPath */ .c)({
32
+ cwd: buildContext.themeSrcDirPath,
33
+ pathIsh: cliCommandOptions.file
34
+ }));
35
+ const uiModuleMetas = await (0,_postinstall_uiModuleMeta__WEBPACK_IMPORTED_MODULE_3__/* .getUiModuleMetas */ .j)({ buildContext });
36
+ const uiModuleMeta = uiModuleMetas.find(({ files }) => files.map(({ fileRelativePath }) => fileRelativePath).includes(fileRelativePath));
37
+ if (!uiModuleMeta) {
38
+ throw new Error(`No UI module found for the file ${fileRelativePath}`);
39
+ }
40
+ const uiModuleDirPath = await (0,_tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getInstalledModuleDirPath */ .p)({
41
+ moduleName: uiModuleMeta.moduleName,
42
+ packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_2__.dirname)(buildContext.packageJsonFilePath),
43
+ projectDirPath: buildContext.projectDirPath
44
+ });
45
+ const sourceCode = await (0,_postinstall_getUiModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__/* .getUiModuleFileSourceCodeReadyToBeCopied */ .X)({
46
+ buildContext,
47
+ fileRelativePath,
48
+ isForEjection: true,
49
+ uiModuleName: uiModuleMeta.moduleName,
50
+ uiModuleDirPath,
51
+ uiModuleVersion: uiModuleMeta.version
52
+ });
53
+ await fs_promises__WEBPACK_IMPORTED_MODULE_5__.writeFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath), sourceCode);
54
+ const { ejectedFilesRelativePaths } = await (0,_postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__/* .readManagedGitignoreFile */ .w)({
55
+ buildContext
56
+ });
57
+ await (0,_postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__/* .writeManagedGitignoreFile */ .Y)({
58
+ buildContext,
59
+ uiModuleMetas,
60
+ ejectedFilesRelativePaths: [...ejectedFilesRelativePaths, fileRelativePath]
61
+ });
62
+ }
63
+ //# sourceMappingURL=eject-file.js.map
64
+
65
+ /***/ })
66
+
67
+ };
68
+ ;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- exports.id = 780;
3
- exports.ids = [780,786];
2
+ exports.id = 921;
3
+ exports.ids = [921,786];
4
4
  exports.modules = {
5
5
 
6
- /***/ 75780:
6
+ /***/ 21921:
7
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
8
 
9
9
  // ESM COMPAT FLAG
@@ -17,9 +17,6 @@ __webpack_require__.d(__webpack_exports__, {
17
17
  // EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
18
18
  var dist = __webpack_require__(99398);
19
19
  var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
20
- // EXTERNAL MODULE: external "child_process"
21
- var external_child_process_ = __webpack_require__(32081);
22
- var external_child_process_default = /*#__PURE__*/__webpack_require__.n(external_child_process_);
23
20
  // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
24
21
  var source = __webpack_require__(78818);
25
22
  var source_default = /*#__PURE__*/__webpack_require__.n(source);
@@ -91,6 +88,38 @@ function updateAccountThemeImplementationInConfig(params) {
91
88
  var update_kc_gen = __webpack_require__(10786);
92
89
  // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
93
90
  var customHandler_delegate = __webpack_require__(72138);
91
+ // EXTERNAL MODULE: external "child_process"
92
+ var external_child_process_ = __webpack_require__(32081);
93
+ var external_child_process_default = /*#__PURE__*/__webpack_require__.n(external_child_process_);
94
+ ;// CONCATENATED MODULE: ./dist/bin/shared/exitIfUncommittedChanges.js
95
+
96
+
97
+ function exitIfUncommittedChanges(params) {
98
+ const { projectDirPath } = params;
99
+ let hasUncommittedChanges = undefined;
100
+ try {
101
+ hasUncommittedChanges =
102
+ external_child_process_default().execSync(`git status --porcelain`, {
103
+ cwd: projectDirPath
104
+ })
105
+ .toString()
106
+ .trim() !== "";
107
+ }
108
+ catch (_a) {
109
+ // Probably not a git repository
110
+ return;
111
+ }
112
+ if (!hasUncommittedChanges) {
113
+ return;
114
+ }
115
+ console.warn([
116
+ source_default().red("Please commit or stash your changes before running this command.\n"),
117
+ "This command will modify your project's files so it's better to have a clean working directory",
118
+ "so that you can easily see what has been changed and revert if needed."
119
+ ].join(" "));
120
+ process.exit(-1);
121
+ }
122
+ //# sourceMappingURL=exitIfUncommittedChanges.js.map
94
123
  ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/initialize-account-theme.js
95
124
 
96
125
 
@@ -115,30 +144,9 @@ async function command(params) {
115
144
  console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
116
145
  process.exit(-1);
117
146
  }
118
- exit_if_uncommitted_changes: {
119
- let hasUncommittedChanges = undefined;
120
- try {
121
- hasUncommittedChanges =
122
- external_child_process_default().execSync(`git status --porcelain`, {
123
- cwd: buildContext.projectDirPath
124
- })
125
- .toString()
126
- .trim() !== "";
127
- }
128
- catch (_a) {
129
- // Probably not a git repository
130
- break exit_if_uncommitted_changes;
131
- }
132
- if (!hasUncommittedChanges) {
133
- break exit_if_uncommitted_changes;
134
- }
135
- console.warn([
136
- source_default().red("Please commit or stash your changes before running this command.\n"),
137
- "This command will modify your project's files so it's better to have a clean working directory",
138
- "so that you can easily see what has been changed and revert if needed."
139
- ].join(" "));
140
- process.exit(-1);
141
- }
147
+ exitIfUncommittedChanges({
148
+ projectDirPath: buildContext.projectDirPath
149
+ });
142
150
  const { value: accountThemeType } = await dist_default()({
143
151
  values: ["Single-Page", "Multi-Page"]
144
152
  }).catch(() => {
@@ -155,7 +163,7 @@ async function command(params) {
155
163
  break;
156
164
  case "Single-Page":
157
165
  {
158
- const { initializeAccountTheme_singlePage } = await Promise.all(/* import() */[__webpack_require__.e(903), __webpack_require__.e(599)]).then(__webpack_require__.bind(__webpack_require__, 97599));
166
+ const { initializeAccountTheme_singlePage } = await Promise.all(/* import() */[__webpack_require__.e(805), __webpack_require__.e(450), __webpack_require__.e(735)]).then(__webpack_require__.bind(__webpack_require__, 84735));
159
167
  await initializeAccountTheme_singlePage({
160
168
  accountThemeSrcDirPath,
161
169
  buildContext
@@ -214,8 +222,8 @@ function readParams(params) {
214
222
  //# sourceMappingURL=customHandler.js.map
215
223
  // EXTERNAL MODULE: external "child_process"
216
224
  var external_child_process_ = __webpack_require__(32081);
217
- // EXTERNAL MODULE: external "path"
218
- var external_path_ = __webpack_require__(71017);
225
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
226
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
219
227
  // EXTERNAL MODULE: external "fs"
220
228
  var external_fs_ = __webpack_require__(57147);
221
229
  ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
@@ -228,25 +236,7 @@ var external_fs_ = __webpack_require__(57147);
228
236
  (0,esm_assert/* assert */.h)();
229
237
  function maybeDelegateCommandToCustomHandler(params) {
230
238
  const { commandName, buildContext } = params;
231
- const nodeModulesBinDirPath = (() => {
232
- const binPath = process.argv[1];
233
- const segments = [".bin"];
234
- let foundNodeModules = false;
235
- for (const segment of binPath.split(external_path_.sep).reverse()) {
236
- skip_segment: {
237
- if (foundNodeModules) {
238
- break skip_segment;
239
- }
240
- if (segment === "node_modules") {
241
- foundNodeModules = true;
242
- break skip_segment;
243
- }
244
- continue;
245
- }
246
- segments.unshift(segment);
247
- }
248
- return segments.join(external_path_.sep);
249
- })();
239
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
250
240
  if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
251
241
  return { hasBeenHandled: false };
252
242
  }
@@ -293,25 +283,63 @@ async function existsAsync(path) {
293
283
 
294
284
  /***/ }),
295
285
 
296
- /***/ 22577:
286
+ /***/ 73776:
297
287
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
298
288
 
299
289
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
300
- /* harmony export */ "S": () => (/* binding */ runFormat)
290
+ /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
301
291
  /* harmony export */ });
302
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
303
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
292
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
293
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
294
+
295
+ let cache = undefined;
296
+ function getNodeModulesBinDirPath() {
297
+ if (cache !== undefined) {
298
+ return cache;
299
+ }
300
+ const binPath = process.argv[1];
301
+ const segments = [".bin"];
302
+ let foundNodeModules = false;
303
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
304
+ skip_segment: {
305
+ if (foundNodeModules) {
306
+ break skip_segment;
307
+ }
308
+ if (segment === "node_modules") {
309
+ foundNodeModules = true;
310
+ break skip_segment;
311
+ }
312
+ continue;
313
+ }
314
+ segments.unshift(segment);
315
+ }
316
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
317
+ cache = nodeModulesBinDirPath;
318
+ return nodeModulesBinDirPath;
319
+ }
320
+ //# sourceMappingURL=nodeModulesBinDirPath.js.map
321
+
322
+ /***/ }),
323
+
324
+ /***/ 48433:
325
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
326
+
327
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
328
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
329
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
330
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
331
+ /* harmony export */ });
332
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
304
333
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
305
334
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
306
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
307
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78818);
308
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_3__);
309
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
310
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52300);
311
- /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16453);
312
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(32081);
313
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_5__);
314
-
335
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
336
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
337
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38469);
338
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
339
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
340
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
341
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
342
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
315
343
 
316
344
 
317
345
 
@@ -319,46 +347,62 @@ async function existsAsync(path) {
319
347
 
320
348
 
321
349
 
322
- function runFormat(params) {
323
- const { packageJsonFilePath } = params;
324
- const parsedPackageJson = (() => {
325
- const zParsedPackageJson = (() => {
326
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_6__.z.object({
327
- scripts: zod__WEBPACK_IMPORTED_MODULE_6__.z.record(zod__WEBPACK_IMPORTED_MODULE_6__.z.string()).optional()
328
- });
329
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
330
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(zTargetType);
331
- })();
332
- const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString("utf8"));
333
- zParsedPackageJson.parse(parsedPackageJson);
334
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_4__.is)(parsedPackageJson));
335
- return parsedPackageJson;
336
- })();
337
- const { scripts } = parsedPackageJson;
338
- if (scripts === undefined) {
339
- return;
350
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
351
+ async function getIsPrettierAvailable() {
352
+ var _a;
353
+ if (getIsPrettierAvailable.cache !== undefined) {
354
+ return getIsPrettierAvailable.cache;
340
355
  }
341
- const scriptKeys = Object.keys(scripts);
342
- const scriptNames = scriptKeys.filter(scriptKey => scriptKey.trim().match(/^(lint|format)/));
343
- for (const scriptName of scriptNames) {
344
- if (!(scriptName in scripts)) {
345
- continue;
346
- }
347
- const command = `npm run ${scriptName}`;
348
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().grey(`$ ${command}`));
349
- try {
350
- child_process__WEBPACK_IMPORTED_MODULE_5__.execSync(`npm run ${scriptName}`, {
351
- stdio: "inherit",
352
- cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
353
- });
356
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
357
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
358
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
359
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
360
+ getIsPrettierAvailable.cache = isPrettierAvailable;
361
+ return isPrettierAvailable;
362
+ }
363
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
364
+ async function getPrettier() {
365
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
366
+ if (getPrettier.cache !== undefined) {
367
+ return getPrettier.cache;
368
+ }
369
+ const prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
370
+ const configHash = await (async () => {
371
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
372
+ if (configFilePath === null) {
373
+ return "";
354
374
  }
355
- catch (_a) {
356
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`\`${command}\` failed, it does not matter, please format your code manually, continuing...`));
375
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
376
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
377
+ })();
378
+ const prettierAndConfig = {
379
+ prettier,
380
+ configHash
381
+ };
382
+ getPrettier.cache = prettierAndConfig;
383
+ return prettierAndConfig;
384
+ }
385
+ async function runPrettier(params) {
386
+ const { sourceCode, filePath } = params;
387
+ let formattedSourceCode;
388
+ try {
389
+ const { prettier } = await getPrettier();
390
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
391
+ resolveConfig: true
392
+ });
393
+ if (ignored) {
394
+ return sourceCode;
357
395
  }
358
- return;
396
+ const config = await prettier.resolveConfig(filePath);
397
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
359
398
  }
399
+ catch (error) {
400
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
401
+ throw error;
402
+ }
403
+ return formattedSourceCode;
360
404
  }
361
- //# sourceMappingURL=runFormat.js.map
405
+ //# sourceMappingURL=runPrettier.js.map
362
406
 
363
407
  /***/ }),
364
408
 
@@ -375,9 +419,9 @@ __webpack_require__.r(__webpack_exports__);
375
419
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
376
420
  /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43765);
377
421
  /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72138);
378
- /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22577);
379
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
380
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
422
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6113);
423
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_4__);
424
+ /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48433);
381
425
 
382
426
 
383
427
 
@@ -393,10 +437,11 @@ async function command(params) {
393
437
  if (hasBeenHandled) {
394
438
  return;
395
439
  }
396
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
440
+ const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
397
441
  const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
398
442
  const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
399
- const newContent = [
443
+ const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
444
+ let newContent = [
400
445
  ``,
401
446
  `/* eslint-disable */`,
402
447
  ``,
@@ -419,6 +464,7 @@ async function command(params) {
419
464
  `type KcContext =`,
420
465
  hasLoginTheme && ` | import("./login/KcContext").KcContext`,
421
466
  hasAccountTheme && ` | import("./account/KcContext").KcContext`,
467
+ hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
422
468
  ` ;`,
423
469
  ``,
424
470
  `declare global {`,
@@ -431,6 +477,8 @@ async function command(params) {
431
477
  `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
432
478
  hasAccountTheme &&
433
479
  `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
480
+ hasAdminTheme &&
481
+ `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
434
482
  ``,
435
483
  `export function KcPage(`,
436
484
  ` props: {`,
@@ -447,6 +495,8 @@ async function command(params) {
447
495
  ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
448
496
  hasAccountTheme &&
449
497
  ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
498
+ hasAdminTheme &&
499
+ ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
450
500
  ` }`,
451
501
  ` })()}`,
452
502
  ` </Suspense>`,
@@ -456,7 +506,7 @@ async function command(params) {
456
506
  ]
457
507
  .filter(item => typeof item === "string")
458
508
  .join("\n");
459
- const hash = crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(newContent).digest("hex");
509
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
460
510
  skip_if_no_changes: {
461
511
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
462
512
  break skip_if_no_changes;
@@ -467,13 +517,22 @@ async function command(params) {
467
517
  }
468
518
  return;
469
519
  }
470
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from([
520
+ newContent = [
471
521
  `// This file is auto-generated by the \`update-kc-gen\` command. Do not edit it manually.`,
472
522
  `// Hash: ${hash}`,
473
523
  ``,
474
524
  newContent
475
- ].join("\n"), "utf8"));
476
- (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_4__/* .runFormat */ .S)({ packageJsonFilePath: buildContext.packageJsonFilePath });
525
+ ].join("\n");
526
+ format: {
527
+ if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .getIsPrettierAvailable */ .MT)())) {
528
+ break format;
529
+ }
530
+ newContent = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .runPrettier */ .eY)({
531
+ filePath,
532
+ sourceCode: newContent
533
+ });
534
+ }
535
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from(newContent, "utf8"));
477
536
  delete_legacy_file: {
478
537
  const legacyFilePath = filePath.replace(/tsx$/, "ts");
479
538
  if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(legacyFilePath))) {
package/bin/932.index.js CHANGED
@@ -137,8 +137,8 @@ function readParams(params) {
137
137
  //# sourceMappingURL=customHandler.js.map
138
138
  // EXTERNAL MODULE: external "child_process"
139
139
  var external_child_process_ = __webpack_require__(32081);
140
- // EXTERNAL MODULE: external "path"
141
- var external_path_ = __webpack_require__(71017);
140
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
141
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
142
142
  // EXTERNAL MODULE: external "fs"
143
143
  var external_fs_ = __webpack_require__(57147);
144
144
  ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
@@ -151,25 +151,7 @@ var external_fs_ = __webpack_require__(57147);
151
151
  (0,esm_assert/* assert */.h)();
152
152
  function maybeDelegateCommandToCustomHandler(params) {
153
153
  const { commandName, buildContext } = params;
154
- const nodeModulesBinDirPath = (() => {
155
- const binPath = process.argv[1];
156
- const segments = [".bin"];
157
- let foundNodeModules = false;
158
- for (const segment of binPath.split(external_path_.sep).reverse()) {
159
- skip_segment: {
160
- if (foundNodeModules) {
161
- break skip_segment;
162
- }
163
- if (segment === "node_modules") {
164
- foundNodeModules = true;
165
- break skip_segment;
166
- }
167
- continue;
168
- }
169
- segments.unshift(segment);
170
- }
171
- return segments.join(external_path_.sep);
172
- })();
154
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
173
155
  if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
174
156
  return { hasBeenHandled: false };
175
157
  }
@@ -235,6 +217,44 @@ function rmSync(dirPath, options) {
235
217
 
236
218
  /***/ }),
237
219
 
220
+ /***/ 73776:
221
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
222
+
223
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
224
+ /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
225
+ /* harmony export */ });
226
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
227
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
228
+
229
+ let cache = undefined;
230
+ function getNodeModulesBinDirPath() {
231
+ if (cache !== undefined) {
232
+ return cache;
233
+ }
234
+ const binPath = process.argv[1];
235
+ const segments = [".bin"];
236
+ let foundNodeModules = false;
237
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
238
+ skip_segment: {
239
+ if (foundNodeModules) {
240
+ break skip_segment;
241
+ }
242
+ if (segment === "node_modules") {
243
+ foundNodeModules = true;
244
+ break skip_segment;
245
+ }
246
+ continue;
247
+ }
248
+ segments.unshift(segment);
249
+ }
250
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
251
+ cache = nodeModulesBinDirPath;
252
+ return nodeModulesBinDirPath;
253
+ }
254
+ //# sourceMappingURL=nodeModulesBinDirPath.js.map
255
+
256
+ /***/ }),
257
+
238
258
  /***/ 60332:
239
259
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
240
260