@keycloakify/angular 21.0.0-rc.2 → 21.0.0-rc.4

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 (131) hide show
  1. package/bin/187.index.js +64 -70
  2. package/bin/476.index.js +62 -68
  3. package/bin/{343.index.js → 644.index.js} +2287 -1200
  4. package/bin/671.index.js +79 -74
  5. package/bin/942.index.js +62 -68
  6. package/bin/index.js +12 -9
  7. package/fesm2022/keycloakify-angular-account-directives-kc-class.mjs +3 -3
  8. package/fesm2022/keycloakify-angular-account-pages-account.mjs +3 -3
  9. package/fesm2022/keycloakify-angular-account-pages-applications.mjs +3 -3
  10. package/fesm2022/keycloakify-angular-account-pages-federatedIdentity.mjs +3 -3
  11. package/fesm2022/keycloakify-angular-account-pages-log.mjs +3 -3
  12. package/fesm2022/keycloakify-angular-account-pages-password.mjs +10 -10
  13. package/fesm2022/keycloakify-angular-account-pages-password.mjs.map +1 -1
  14. package/fesm2022/keycloakify-angular-account-pages-sessions.mjs +3 -3
  15. package/fesm2022/keycloakify-angular-account-pages-totp.mjs +3 -3
  16. package/fesm2022/keycloakify-angular-account-services-account-resource-injector.mjs +3 -3
  17. package/fesm2022/keycloakify-angular-account-services-i18n.mjs +3 -3
  18. package/fesm2022/keycloakify-angular-account-template.mjs +4 -4
  19. package/fesm2022/keycloakify-angular-account-template.mjs.map +1 -1
  20. package/fesm2022/keycloakify-angular-lib-directives-attributes.mjs +4 -4
  21. package/fesm2022/keycloakify-angular-lib-directives-attributes.mjs.map +1 -1
  22. package/fesm2022/keycloakify-angular-lib-pipes-input-type.mjs +3 -3
  23. package/fesm2022/keycloakify-angular-lib-pipes-is-array-with-empty-object.mjs +3 -3
  24. package/fesm2022/keycloakify-angular-lib-pipes-kc-sanitize.mjs +3 -3
  25. package/fesm2022/keycloakify-angular-lib-pipes-to-array.mjs +3 -3
  26. package/fesm2022/keycloakify-angular-lib-pipes-to-number.mjs +3 -3
  27. package/fesm2022/keycloakify-angular-lib-services-resource-injector.mjs +3 -3
  28. package/fesm2022/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs +8 -8
  29. package/fesm2022/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs.map +1 -1
  30. package/fesm2022/keycloakify-angular-login-components-field-errors.mjs +6 -6
  31. package/fesm2022/keycloakify-angular-login-components-field-errors.mjs.map +1 -1
  32. package/fesm2022/keycloakify-angular-login-components-group-label.mjs +6 -6
  33. package/fesm2022/keycloakify-angular-login-components-group-label.mjs.map +1 -1
  34. package/fesm2022/keycloakify-angular-login-components-input-field-by-type.mjs +7 -7
  35. package/fesm2022/keycloakify-angular-login-components-input-field-by-type.mjs.map +1 -1
  36. package/fesm2022/keycloakify-angular-login-components-input-tag-selects.mjs +8 -8
  37. package/fesm2022/keycloakify-angular-login-components-input-tag-selects.mjs.map +1 -1
  38. package/fesm2022/keycloakify-angular-login-components-input-tag.mjs +9 -9
  39. package/fesm2022/keycloakify-angular-login-components-input-tag.mjs.map +1 -1
  40. package/fesm2022/keycloakify-angular-login-components-logout-other-sessions.mjs +3 -3
  41. package/fesm2022/keycloakify-angular-login-components-password-wrapper.mjs +5 -5
  42. package/fesm2022/keycloakify-angular-login-components-password-wrapper.mjs.map +1 -1
  43. package/fesm2022/keycloakify-angular-login-components-select-tag.mjs +8 -8
  44. package/fesm2022/keycloakify-angular-login-components-select-tag.mjs.map +1 -1
  45. package/fesm2022/keycloakify-angular-login-components-textarea-tag.mjs +6 -6
  46. package/fesm2022/keycloakify-angular-login-components-textarea-tag.mjs.map +1 -1
  47. package/fesm2022/keycloakify-angular-login-components-user-profile-form-fields.mjs +3 -3
  48. package/fesm2022/keycloakify-angular-login-directives-kc-class.mjs +3 -3
  49. package/fesm2022/keycloakify-angular-login-pages-code.mjs +6 -6
  50. package/fesm2022/keycloakify-angular-login-pages-code.mjs.map +1 -1
  51. package/fesm2022/keycloakify-angular-login-pages-delete-account-confirm.mjs +6 -6
  52. package/fesm2022/keycloakify-angular-login-pages-delete-account-confirm.mjs.map +1 -1
  53. package/fesm2022/keycloakify-angular-login-pages-delete-credential.mjs +6 -6
  54. package/fesm2022/keycloakify-angular-login-pages-delete-credential.mjs.map +1 -1
  55. package/fesm2022/keycloakify-angular-login-pages-error.mjs +6 -6
  56. package/fesm2022/keycloakify-angular-login-pages-error.mjs.map +1 -1
  57. package/fesm2022/keycloakify-angular-login-pages-frontchannel-logout.mjs +7 -7
  58. package/fesm2022/keycloakify-angular-login-pages-frontchannel-logout.mjs.map +1 -1
  59. package/fesm2022/keycloakify-angular-login-pages-idp-review-user-profile.mjs +7 -7
  60. package/fesm2022/keycloakify-angular-login-pages-idp-review-user-profile.mjs.map +1 -1
  61. package/fesm2022/keycloakify-angular-login-pages-info.mjs +6 -6
  62. package/fesm2022/keycloakify-angular-login-pages-info.mjs.map +1 -1
  63. package/fesm2022/keycloakify-angular-login-pages-login-config-totp.mjs +6 -6
  64. package/fesm2022/keycloakify-angular-login-pages-login-config-totp.mjs.map +1 -1
  65. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm-override.mjs +6 -6
  66. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm-override.mjs.map +1 -1
  67. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm.mjs +6 -6
  68. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm.mjs.map +1 -1
  69. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-email.mjs +6 -6
  70. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-email.mjs.map +1 -1
  71. package/fesm2022/keycloakify-angular-login-pages-login-oauth-grant.mjs +6 -6
  72. package/fesm2022/keycloakify-angular-login-pages-login-oauth-grant.mjs.map +1 -1
  73. package/fesm2022/keycloakify-angular-login-pages-login-oauth2-device-verify-user-code.mjs +6 -6
  74. package/fesm2022/keycloakify-angular-login-pages-login-oauth2-device-verify-user-code.mjs.map +1 -1
  75. package/fesm2022/keycloakify-angular-login-pages-login-otp.mjs +6 -6
  76. package/fesm2022/keycloakify-angular-login-pages-login-otp.mjs.map +1 -1
  77. package/fesm2022/keycloakify-angular-login-pages-login-page-expired.mjs +6 -6
  78. package/fesm2022/keycloakify-angular-login-pages-login-page-expired.mjs.map +1 -1
  79. package/fesm2022/keycloakify-angular-login-pages-login-passkeys-conditional-authenticate.mjs +6 -6
  80. package/fesm2022/keycloakify-angular-login-pages-login-passkeys-conditional-authenticate.mjs.map +1 -1
  81. package/fesm2022/keycloakify-angular-login-pages-login-password.mjs +7 -7
  82. package/fesm2022/keycloakify-angular-login-pages-login-password.mjs.map +1 -1
  83. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-config.mjs +7 -7
  84. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-config.mjs.map +1 -1
  85. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-input.mjs +6 -6
  86. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-input.mjs.map +1 -1
  87. package/fesm2022/keycloakify-angular-login-pages-login-reset-otp.mjs +6 -6
  88. package/fesm2022/keycloakify-angular-login-pages-login-reset-otp.mjs.map +1 -1
  89. package/fesm2022/keycloakify-angular-login-pages-login-reset-password.mjs +6 -6
  90. package/fesm2022/keycloakify-angular-login-pages-login-reset-password.mjs.map +1 -1
  91. package/fesm2022/keycloakify-angular-login-pages-login-update-password.mjs +6 -6
  92. package/fesm2022/keycloakify-angular-login-pages-login-update-password.mjs.map +1 -1
  93. package/fesm2022/keycloakify-angular-login-pages-login-update-profile.mjs +7 -7
  94. package/fesm2022/keycloakify-angular-login-pages-login-update-profile.mjs.map +1 -1
  95. package/fesm2022/keycloakify-angular-login-pages-login-username.mjs +7 -7
  96. package/fesm2022/keycloakify-angular-login-pages-login-username.mjs.map +1 -1
  97. package/fesm2022/keycloakify-angular-login-pages-login-verify-email.mjs +6 -6
  98. package/fesm2022/keycloakify-angular-login-pages-login-verify-email.mjs.map +1 -1
  99. package/fesm2022/keycloakify-angular-login-pages-login-x509-info.mjs +6 -6
  100. package/fesm2022/keycloakify-angular-login-pages-login-x509-info.mjs.map +1 -1
  101. package/fesm2022/keycloakify-angular-login-pages-login.mjs +7 -7
  102. package/fesm2022/keycloakify-angular-login-pages-login.mjs.map +1 -1
  103. package/fesm2022/keycloakify-angular-login-pages-logout-confirm.mjs +6 -6
  104. package/fesm2022/keycloakify-angular-login-pages-logout-confirm.mjs.map +1 -1
  105. package/fesm2022/keycloakify-angular-login-pages-register.mjs +8 -8
  106. package/fesm2022/keycloakify-angular-login-pages-register.mjs.map +1 -1
  107. package/fesm2022/keycloakify-angular-login-pages-saml-post-form.mjs +7 -7
  108. package/fesm2022/keycloakify-angular-login-pages-saml-post-form.mjs.map +1 -1
  109. package/fesm2022/keycloakify-angular-login-pages-select-authenticator.mjs +6 -6
  110. package/fesm2022/keycloakify-angular-login-pages-select-authenticator.mjs.map +1 -1
  111. package/fesm2022/keycloakify-angular-login-pages-terms.mjs +6 -6
  112. package/fesm2022/keycloakify-angular-login-pages-terms.mjs.map +1 -1
  113. package/fesm2022/keycloakify-angular-login-pages-update-email.mjs +7 -7
  114. package/fesm2022/keycloakify-angular-login-pages-update-email.mjs.map +1 -1
  115. package/fesm2022/keycloakify-angular-login-pages-webauthn-authenticate.mjs +6 -6
  116. package/fesm2022/keycloakify-angular-login-pages-webauthn-authenticate.mjs.map +1 -1
  117. package/fesm2022/keycloakify-angular-login-pages-webauthn-error.mjs +6 -6
  118. package/fesm2022/keycloakify-angular-login-pages-webauthn-error.mjs.map +1 -1
  119. package/fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs +6 -6
  120. package/fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs.map +1 -1
  121. package/fesm2022/keycloakify-angular-login-services-i18n.mjs +3 -3
  122. package/fesm2022/keycloakify-angular-login-services-login-resource-injector.mjs +3 -3
  123. package/fesm2022/keycloakify-angular-login-services-user-profile-form.mjs +3 -3
  124. package/fesm2022/keycloakify-angular-login-template.mjs +8 -8
  125. package/fesm2022/keycloakify-angular-login-template.mjs.map +1 -1
  126. package/package.json +1 -1
  127. package/src/bin/eject-page.ts +27 -10
  128. package/src/bin/tools/getThisCodebaseRootDirPath.ts +7 -0
  129. package/src/bin/tools/nodeModulesBinDirPath.ts +34 -1
  130. package/src/bin/tools/runPrettier.ts +43 -39
  131. package/src/bin/tools/readThisNpmPackageVersion.ts +0 -24
package/bin/671.index.js CHANGED
@@ -908,6 +908,7 @@ async function command(params) {
908
908
  }
909
909
  return (0,external_path_.join)('pages', pageIdOrComponent.replace(/\.ftl$/, ''));
910
910
  })();
911
+ let hasEjectedUserProfileFormFieldsComponent = false;
911
912
  {
912
913
  const componentDirRelativeToThemeTypePaths = [
913
914
  componentDirRelativeToThemeTypePath
@@ -915,6 +916,10 @@ async function command(params) {
915
916
  while (componentDirRelativeToThemeTypePaths.length !== 0) {
916
917
  const componentDirRelativeToThemeTypePath_i = componentDirRelativeToThemeTypePaths.pop();
917
918
  (0,assert/* assert */.v)(componentDirRelativeToThemeTypePath_i !== undefined);
919
+ if (componentDirRelativeToThemeTypePath_i ===
920
+ (0,external_path_.join)('components', 'user-profile-form-fields')) {
921
+ hasEjectedUserProfileFormFieldsComponent = true;
922
+ }
918
923
  const destDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, componentDirRelativeToThemeTypePath_i);
919
924
  const dirName = (0,external_path_.basename)(destDirPath);
920
925
  const tsFilePath = (0,external_path_.join)(destDirPath, `${dirName}.component.ts`);
@@ -994,12 +999,21 @@ async function command(params) {
994
999
  }
995
1000
  }
996
1001
  edit_KcFiles: {
997
- if (pageIdOrComponent !== templateValue &&
998
- pageIdOrComponent !== userProfileFormFieldsValue) {
1002
+ const componentRelativeDirPath_posix = (() => {
1003
+ if (pageIdOrComponent === templateValue) {
1004
+ return 'template';
1005
+ }
1006
+ if (pageIdOrComponent === userProfileFormFieldsValue ||
1007
+ hasEjectedUserProfileFormFieldsComponent) {
1008
+ return 'components/user-profile-form-fields';
1009
+ }
1010
+ return undefined;
1011
+ })();
1012
+ if (componentRelativeDirPath_posix === undefined) {
999
1013
  break edit_KcFiles;
1000
1014
  }
1001
1015
  const filesToProcess = ['KcPage.ts', 'KcPageStory.ts'];
1002
- for (let fileName of filesToProcess) {
1016
+ for (const fileName of filesToProcess) {
1003
1017
  const filePath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, fileName);
1004
1018
  if (!external_fs_.existsSync(filePath)) {
1005
1019
  console.log(source/* default */.Ay.yellow(`${fileName} not found, skipping`));
@@ -1007,9 +1021,6 @@ async function command(params) {
1007
1021
  }
1008
1022
  const originalCode = external_fs_.readFileSync(filePath).toString('utf8');
1009
1023
  const modifiedCode = await (async () => {
1010
- const componentRelativeDirPath_posix = componentDirRelativeToThemeTypePath
1011
- .split(external_path_.sep)
1012
- .join('/');
1013
1024
  let sourceCode = originalCode.replace(`@keycloakify/angular/${themeType}/${componentRelativeDirPath_posix}`, componentRelativeDirPath_posix_to_componentRelativeFilePath_posix({
1014
1025
  componentRelativeDirPath_posix: `./${componentRelativeDirPath_posix}`
1015
1026
  }));
@@ -1104,7 +1115,8 @@ async function command(params) {
1104
1115
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1105
1116
 
1106
1117
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1107
- /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
1118
+ /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
1119
+ /* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
1108
1120
  /* harmony export */ });
1109
1121
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
1110
1122
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
@@ -1129,6 +1141,12 @@ function getThisCodebaseRootDirPath() {
1129
1141
  }
1130
1142
  return (result = getThisCodebaseRootDirPath_rec(__dirname));
1131
1143
  }
1144
+ function getNearestPackageJsonDirPath(dirPath) {
1145
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
1146
+ return dirPath;
1147
+ }
1148
+ return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
1149
+ }
1132
1150
 
1133
1151
 
1134
1152
  /***/ }),
@@ -1141,13 +1159,35 @@ function getThisCodebaseRootDirPath() {
1141
1159
  /* harmony export */ });
1142
1160
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
1143
1161
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1162
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(221);
1163
+
1144
1164
 
1145
1165
  let cache = undefined;
1166
+ /** NOTE: Careful, this function can fail when the binary
1167
+ * Used is not in the node_modules directory of the project
1168
+ * (for example when running tests with vscode extension we'll get
1169
+ * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
1170
+ *
1171
+ * instead of
1172
+ * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
1173
+ * or
1174
+ * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
1175
+ *
1176
+ * as the value of process.argv[1]
1177
+ */
1146
1178
  function getNodeModulesBinDirPath() {
1147
1179
  if (cache !== undefined) {
1148
1180
  return cache;
1149
1181
  }
1150
1182
  const binPath = process.argv[1];
1183
+ special_case_running_not_from_distribution: {
1184
+ if (!binPath.endsWith('.ts')) {
1185
+ break special_case_running_not_from_distribution;
1186
+ }
1187
+ const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
1188
+ const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
1189
+ return nodeModulesBinDirPath;
1190
+ }
1151
1191
  const segments = ['.bin'];
1152
1192
  let foundNodeModules = false;
1153
1193
  for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
@@ -1163,43 +1203,15 @@ function getNodeModulesBinDirPath() {
1163
1203
  }
1164
1204
  segments.unshift(segment);
1165
1205
  }
1206
+ if (!foundNodeModules) {
1207
+ throw new Error(`Could not find node_modules in path ${binPath}`);
1208
+ }
1166
1209
  const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
1167
1210
  cache = nodeModulesBinDirPath;
1168
1211
  return nodeModulesBinDirPath;
1169
1212
  }
1170
1213
 
1171
1214
 
1172
- /***/ }),
1173
-
1174
- /***/ 972:
1175
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1176
-
1177
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1178
- /* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
1179
- /* harmony export */ });
1180
- /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(221);
1181
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(559);
1182
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
1183
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
1184
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
1185
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1186
-
1187
-
1188
-
1189
-
1190
- let cache = undefined;
1191
- function readThisNpmPackageVersion() {
1192
- if (cache !== undefined) {
1193
- return cache;
1194
- }
1195
- const version = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getThisCodebaseRootDirPath */ .J)(), 'package.json'))
1196
- .toString('utf8'))['version'];
1197
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .v)(typeof version === 'string');
1198
- cache = version;
1199
- return version;
1200
- }
1201
-
1202
-
1203
1215
  /***/ }),
1204
1216
 
1205
1217
  /***/ 915:
@@ -1210,21 +1222,19 @@ function readThisNpmPackageVersion() {
1210
1222
  /* harmony export */ L: () => (/* binding */ getIsPrettierAvailable)
1211
1223
  /* harmony export */ });
1212
1224
  /* unused harmony export getPrettier */
1213
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(395);
1214
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
1215
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1225
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(276);
1226
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(982);
1227
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_0__);
1216
1228
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(943);
1217
1229
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
1218
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94);
1230
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(928);
1231
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
1219
1232
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(559);
1220
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(276);
1221
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
1222
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
1223
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(886);
1224
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(972);
1233
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94);
1234
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(886);
1235
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(395);
1225
1236
  /* module decorator */ module = __webpack_require__.hmd(module);
1226
-
1227
-
1237
+ /* eslint-disable @typescript-eslint/consistent-type-imports */
1228
1238
 
1229
1239
 
1230
1240
 
@@ -1240,7 +1250,7 @@ async function getIsPrettierAvailable() {
1240
1250
  return getIsPrettierAvailable.cache;
1241
1251
  }
1242
1252
  const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)();
1243
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(nodeModulesBinDirPath, 'prettier');
1253
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(nodeModulesBinDirPath, 'prettier');
1244
1254
  const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.stat(prettierBinPath).catch(() => undefined);
1245
1255
  const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
1246
1256
  getIsPrettierAvailable.cache = isPrettierAvailable;
@@ -1254,33 +1264,26 @@ async function getPrettier() {
1254
1264
  }
1255
1265
  let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_3__.id)(undefined);
1256
1266
  import_prettier: {
1257
- // NOTE: When module is linked we want to make sure we import the correct version
1258
- // of prettier, that is the one of the project, not the one of this repo.
1259
- // So we do a sketchy eval to bypass ncc.
1260
- // We make sure to only do that when linking, otherwise we import properly.
1261
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
1262
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
1263
- const isCJS = true && module.exports;
1264
- if (isCJS) {
1265
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
1266
- }
1267
- else {
1268
- prettier = await new Promise(_resolve => {
1269
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
1270
- });
1271
- }
1272
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(prettier));
1273
- break import_prettier;
1267
+ const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
1268
+ const isCJS = true && module.exports;
1269
+ if (isCJS) {
1270
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
1271
+ }
1272
+ else {
1273
+ prettier = await new Promise(_resolve => {
1274
+ eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_2__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
1275
+ });
1274
1276
  }
1275
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 166));
1277
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(prettier));
1278
+ break import_prettier;
1276
1279
  }
1277
1280
  const configHash = await (async () => {
1278
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..'));
1281
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
1279
1282
  if (configFilePath === null) {
1280
1283
  return '';
1281
1284
  }
1282
1285
  const data = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(configFilePath);
1283
- return crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(data).digest('hex');
1286
+ return crypto__WEBPACK_IMPORTED_MODULE_0__.createHash('sha256').update(data).digest('hex');
1284
1287
  })();
1285
1288
  const prettierAndConfig = {
1286
1289
  prettier,
@@ -1297,17 +1300,19 @@ async function runPrettier(params) {
1297
1300
  const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
1298
1301
  resolveConfig: true
1299
1302
  });
1300
- if (ignored) {
1303
+ if (ignored || inferredParser === null) {
1301
1304
  return sourceCode;
1302
1305
  }
1303
1306
  const config = await prettier.resolveConfig(filePath);
1304
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
1307
+ formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
1305
1308
  }
1306
1309
  catch (error) {
1307
- console.log(chalk__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
1310
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
1308
1311
  throw error;
1309
1312
  }
1310
- return formattedSourceCode;
1313
+ return typeof sourceCode === 'string'
1314
+ ? formattedSourceCode
1315
+ : Buffer.from(formattedSourceCode, 'utf8');
1311
1316
  }
1312
1317
 
1313
1318
 
package/bin/942.index.js CHANGED
@@ -678,7 +678,8 @@ async function command(params) {
678
678
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
679
679
 
680
680
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
681
- /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
681
+ /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
682
+ /* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
682
683
  /* harmony export */ });
683
684
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
684
685
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
@@ -703,6 +704,12 @@ function getThisCodebaseRootDirPath() {
703
704
  }
704
705
  return (result = getThisCodebaseRootDirPath_rec(__dirname));
705
706
  }
707
+ function getNearestPackageJsonDirPath(dirPath) {
708
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
709
+ return dirPath;
710
+ }
711
+ return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
712
+ }
706
713
 
707
714
 
708
715
  /***/ }),
@@ -715,13 +722,35 @@ function getThisCodebaseRootDirPath() {
715
722
  /* harmony export */ });
716
723
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
717
724
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
725
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(221);
726
+
718
727
 
719
728
  let cache = undefined;
729
+ /** NOTE: Careful, this function can fail when the binary
730
+ * Used is not in the node_modules directory of the project
731
+ * (for example when running tests with vscode extension we'll get
732
+ * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
733
+ *
734
+ * instead of
735
+ * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
736
+ * or
737
+ * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
738
+ *
739
+ * as the value of process.argv[1]
740
+ */
720
741
  function getNodeModulesBinDirPath() {
721
742
  if (cache !== undefined) {
722
743
  return cache;
723
744
  }
724
745
  const binPath = process.argv[1];
746
+ special_case_running_not_from_distribution: {
747
+ if (!binPath.endsWith('.ts')) {
748
+ break special_case_running_not_from_distribution;
749
+ }
750
+ const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
751
+ const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
752
+ return nodeModulesBinDirPath;
753
+ }
725
754
  const segments = ['.bin'];
726
755
  let foundNodeModules = false;
727
756
  for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
@@ -737,43 +766,15 @@ function getNodeModulesBinDirPath() {
737
766
  }
738
767
  segments.unshift(segment);
739
768
  }
769
+ if (!foundNodeModules) {
770
+ throw new Error(`Could not find node_modules in path ${binPath}`);
771
+ }
740
772
  const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
741
773
  cache = nodeModulesBinDirPath;
742
774
  return nodeModulesBinDirPath;
743
775
  }
744
776
 
745
777
 
746
- /***/ }),
747
-
748
- /***/ 972:
749
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
750
-
751
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
752
- /* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
753
- /* harmony export */ });
754
- /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(221);
755
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(559);
756
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
757
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
758
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
759
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
760
-
761
-
762
-
763
-
764
- let cache = undefined;
765
- function readThisNpmPackageVersion() {
766
- if (cache !== undefined) {
767
- return cache;
768
- }
769
- const version = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getThisCodebaseRootDirPath */ .J)(), 'package.json'))
770
- .toString('utf8'))['version'];
771
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .v)(typeof version === 'string');
772
- cache = version;
773
- return version;
774
- }
775
-
776
-
777
778
  /***/ }),
778
779
 
779
780
  /***/ 915:
@@ -784,21 +785,19 @@ function readThisNpmPackageVersion() {
784
785
  /* harmony export */ L: () => (/* binding */ getIsPrettierAvailable)
785
786
  /* harmony export */ });
786
787
  /* unused harmony export getPrettier */
787
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(395);
788
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
789
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
788
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(276);
789
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(982);
790
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_0__);
790
791
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(943);
791
792
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
792
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94);
793
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(928);
794
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
793
795
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(559);
794
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(276);
795
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
796
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
797
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(886);
798
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(972);
796
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94);
797
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(886);
798
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(395);
799
799
  /* module decorator */ module = __webpack_require__.hmd(module);
800
-
801
-
800
+ /* eslint-disable @typescript-eslint/consistent-type-imports */
802
801
 
803
802
 
804
803
 
@@ -814,7 +813,7 @@ async function getIsPrettierAvailable() {
814
813
  return getIsPrettierAvailable.cache;
815
814
  }
816
815
  const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)();
817
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(nodeModulesBinDirPath, 'prettier');
816
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(nodeModulesBinDirPath, 'prettier');
818
817
  const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.stat(prettierBinPath).catch(() => undefined);
819
818
  const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
820
819
  getIsPrettierAvailable.cache = isPrettierAvailable;
@@ -828,33 +827,26 @@ async function getPrettier() {
828
827
  }
829
828
  let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_3__.id)(undefined);
830
829
  import_prettier: {
831
- // NOTE: When module is linked we want to make sure we import the correct version
832
- // of prettier, that is the one of the project, not the one of this repo.
833
- // So we do a sketchy eval to bypass ncc.
834
- // We make sure to only do that when linking, otherwise we import properly.
835
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
836
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
837
- const isCJS = true && module.exports;
838
- if (isCJS) {
839
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
840
- }
841
- else {
842
- prettier = await new Promise(_resolve => {
843
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
844
- });
845
- }
846
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(prettier));
847
- break import_prettier;
830
+ const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
831
+ const isCJS = true && module.exports;
832
+ if (isCJS) {
833
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
834
+ }
835
+ else {
836
+ prettier = await new Promise(_resolve => {
837
+ eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_2__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
838
+ });
848
839
  }
849
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 166));
840
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(prettier));
841
+ break import_prettier;
850
842
  }
851
843
  const configHash = await (async () => {
852
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..'));
844
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
853
845
  if (configFilePath === null) {
854
846
  return '';
855
847
  }
856
848
  const data = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(configFilePath);
857
- return crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(data).digest('hex');
849
+ return crypto__WEBPACK_IMPORTED_MODULE_0__.createHash('sha256').update(data).digest('hex');
858
850
  })();
859
851
  const prettierAndConfig = {
860
852
  prettier,
@@ -871,17 +863,19 @@ async function runPrettier(params) {
871
863
  const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
872
864
  resolveConfig: true
873
865
  });
874
- if (ignored) {
866
+ if (ignored || inferredParser === null) {
875
867
  return sourceCode;
876
868
  }
877
869
  const config = await prettier.resolveConfig(filePath);
878
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
870
+ formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
879
871
  }
880
872
  catch (error) {
881
- console.log(chalk__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
873
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
882
874
  throw error;
883
875
  }
884
- return formattedSourceCode;
876
+ return typeof sourceCode === 'string'
877
+ ? formattedSourceCode
878
+ : Buffer.from(formattedSourceCode, 'utf8');
885
879
  }
886
880
 
887
881
 
package/bin/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
3
2
  import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
4
3
  /******/ var __webpack_modules__ = ({
5
4
 
@@ -89,13 +88,6 @@ const TEST_APP_URL = "https://my-theme.keycloakify.dev";
89
88
 
90
89
  /***/ }),
91
90
 
92
- /***/ 166:
93
- /***/ ((module) => {
94
-
95
- module.exports = __WEBPACK_EXTERNAL_MODULE_prettier__;
96
-
97
- /***/ }),
98
-
99
91
  /***/ 317:
100
92
  /***/ ((module) => {
101
93
 
@@ -986,6 +978,17 @@ function is(value) {
986
978
  /******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
987
979
  /******/ })();
988
980
  /******/
981
+ /******/ /* webpack/runtime/make namespace object */
982
+ /******/ (() => {
983
+ /******/ // define __esModule on exports
984
+ /******/ __nccwpck_require__.r = (exports) => {
985
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
986
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
987
+ /******/ }
988
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
989
+ /******/ };
990
+ /******/ })();
991
+ /******/
989
992
  /******/ /* webpack/runtime/compat */
990
993
  /******/
991
994
  /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
@@ -1109,7 +1112,7 @@ const { buildContext, commandName } = readParams({ apiVersion: 'v1' });
1109
1112
  return;
1110
1113
  case 'initialize-account-theme':
1111
1114
  {
1112
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(343), __nccwpck_require__.e(187)]).then(__nccwpck_require__.bind(__nccwpck_require__, 187));
1115
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(644), __nccwpck_require__.e(187)]).then(__nccwpck_require__.bind(__nccwpck_require__, 187));
1113
1116
  command({ buildContext });
1114
1117
  }
1115
1118
  return;
@@ -120,10 +120,10 @@ class KcClassDirective {
120
120
  });
121
121
  }
122
122
  }
123
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: KcClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
124
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.1", type: KcClassDirective, isStandalone: true, selector: "[kcClass]", inputs: { klass: ["class", "klass"], ngClass: "ngClass", kcClass: "kcClass" }, ngImport: i0 }); }
123
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: KcClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
124
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.5", type: KcClassDirective, isStandalone: true, selector: "[kcClass]", inputs: { klass: ["class", "klass"], ngClass: "ngClass", kcClass: "kcClass" }, ngImport: i0 }); }
125
125
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: KcClassDirective, decorators: [{
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: KcClassDirective, decorators: [{
127
127
  type: Directive,
128
128
  args: [{ selector: '[kcClass]' }]
129
129
  }], propDecorators: { klass: [{
@@ -20,15 +20,15 @@ class AccountComponent extends ComponentReference {
20
20
  };
21
21
  this.active = 'account';
22
22
  }
23
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: AccountComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
24
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.1", type: AccountComponent, isStandalone: true, selector: "kc-account", providers: [
23
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: AccountComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
24
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.5", type: AccountComponent, isStandalone: true, selector: "kc-account", providers: [
25
25
  {
26
26
  provide: ComponentReference,
27
27
  useExisting: forwardRef(() => AccountComponent)
28
28
  }
29
29
  ], usesInheritance: true, ngImport: i0, template: "@let url = kcContext.url;\n@let realm = kcContext.realm;\n@let messagesPerField = kcContext.messagesPerField;\n@let stateChecker = kcContext.stateChecker;\n@let account = kcContext.account;\n@let referrer = kcContext.referrer;\n\n<div class=\"row\">\n <div class=\"col-md-10\">\n <h2>{{ i18n.msgStr('editAccountHtmlTitle') }}</h2>\n </div>\n <div class=\"col-md-2 subtitle\">\n <span class=\"subtitle\"> <span class=\"required\">*</span> {{ i18n.msgStr('requiredFields') }} </span>\n </div>\n</div>\n<form\n class=\"form-horizontal\"\n method=\"post\"\n [action]=\"url.accountUrl\"\n>\n <input\n type=\"hidden\"\n id=\"stateChecker\"\n name=\"stateChecker\"\n [value]=\"stateChecker\"\n />\n @if (!realm.registrationEmailAsUsername) {\n <div\n class=\"form-group\"\n [class.has-error]=\"messagesPerField.existsError('username')\"\n >\n <div class=\"col-sm-2 col-md-2\">\n <label\n for=\"username\"\n class=\"control-label\"\n >\n {{ i18n.msgStr('username') }}\n </label>\n @if (realm.editUsernameAllowed) {\n <span class=\"required\">*</span>\n }\n </div>\n\n <div class=\"col-sm-10 col-md-10\">\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"username\"\n name=\"username\"\n [disabled]=\"!realm.editUsernameAllowed\"\n [defaultValue]=\"account.username ?? ''\"\n />\n </div>\n </div>\n }\n\n <div\n class=\"form-group\"\n [class.has-error]=\"messagesPerField.existsError('email')\"\n >\n <div class=\"col-sm-2 col-md-2\">\n <label\n for=\"email\"\n class=\"control-label\"\n >\n {{ i18n.msgStr('email') }}\n </label>\n <span class=\"required\">*</span>\n </div>\n\n <div class=\"col-sm-10 col-md-10\">\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"email\"\n name=\"email\"\n autofocus\n [defaultValue]=\"account.email ?? ''\"\n />\n </div>\n </div>\n\n <div\n class=\"form-group\"\n [class.has-error]=\"messagesPerField.existsError('firstName')\"\n >\n <div class=\"col-sm-2 col-md-2\">\n <label\n for=\"firstName\"\n class=\"control-label\"\n >\n {{ i18n.msgStr('firstName') }}\n </label>\n <span class=\"required\">*</span>\n </div>\n\n <div class=\"col-sm-10 col-md-10\">\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"firstName\"\n name=\"firstName\"\n [defaultValue]=\"account.firstName\"\n />\n </div>\n </div>\n\n <div\n class=\"form-group\"\n [class.has-error]=\"messagesPerField.existsError('lastName')\"\n >\n <div class=\"col-sm-2 col-md-2\">\n <label\n for=\"lastName\"\n class=\"control-label\"\n >\n {{ i18n.msgStr('lastName') }}\n </label>\n <span class=\"required\">*</span>\n </div>\n\n <div class=\"col-sm-10 col-md-10\">\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"lastName\"\n name=\"lastName\"\n [defaultValue]=\"account.lastName ?? ''\"\n />\n </div>\n </div>\n\n <div class=\"form-group\">\n <div\n id=\"kc-form-buttons\"\n class=\"col-md-offset-2 col-md-10 submit\"\n >\n <div>\n @if (referrer) {\n <a\n [href]=\"referrer!.url\"\n [innerHTML]=\"i18n.msgStr('backToApplication') | kcSanitize: 'html'\"\n >\n </a>\n }\n <button\n type=\"submit\"\n name=\"submitAction\"\n value=\"Save\"\n [kcClass]=\"['kcButtonClass', 'kcButtonPrimaryClass', 'kcButtonLargeClass']\"\n >\n {{ i18n.msgStr('doSave') }}\n </button>\n <button\n type=\"submit\"\n name=\"submitAction\"\n value=\"Cancel\"\n [kcClass]=\"['kcButtonClass', 'kcButtonPrimaryClass', 'kcButtonLargeClass']\"\n >\n {{ i18n.msgStr('doCancel') }}\n </button>\n </div>\n </div>\n </div>\n</form>\n", dependencies: [{ kind: "directive", type: KcClassDirective, selector: "[kcClass]", inputs: ["class", "ngClass", "kcClass"] }, { kind: "pipe", type: KcSanitizePipe, name: "kcSanitize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
30
30
  }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: AccountComponent, decorators: [{
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: AccountComponent, decorators: [{
32
32
  type: Component,
33
33
  args: [{ imports: [KcClassDirective, KcSanitizePipe], selector: 'kc-account', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
34
34
  {
@@ -18,15 +18,15 @@ class ApplicationsComponent extends ComponentReference {
18
18
  this.classes = inject(ACCOUNT_CLASSES);
19
19
  this.active = 'applications';
20
20
  }
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: ApplicationsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
22
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.1", type: ApplicationsComponent, isStandalone: true, selector: "kc-applications", providers: [
21
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ApplicationsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
22
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.5", type: ApplicationsComponent, isStandalone: true, selector: "kc-applications", providers: [
23
23
  {
24
24
  provide: ComponentReference,
25
25
  useExisting: forwardRef(() => ApplicationsComponent)
26
26
  }
27
27
  ], usesInheritance: true, ngImport: i0, template: "@let url = kcContext.url;\n@let stateChecker = kcContext.stateChecker;\n@let applications = kcContext.applications?.applications;\n\n<div class=\"row\">\n <div class=\"col-md-10\">\n <h2>{{ i18n.msgStr('applicationsHtmlTitle') }}</h2>\n </div>\n\n <form\n method=\"post\"\n [action]=\"url.applicationsUrl\"\n >\n <input\n type=\"hidden\"\n id=\"stateChecker\"\n name=\"stateChecker\"\n [value]=\"stateChecker\"\n />\n <input\n type=\"hidden\"\n id=\"referrer\"\n name=\"referrer\"\n [value]=\"stateChecker\"\n />\n\n <table class=\"table table-striped table-bordered\">\n <thead>\n <tr>\n <td>{{ i18n.msgStr('application') }}</td>\n <td>{{ i18n.msgStr('availableRoles') }}</td>\n <td>{{ i18n.msgStr('grantedPermissions') }}</td>\n <td>{{ i18n.msgStr('additionalGrants') }}</td>\n <td>{{ i18n.msgStr('action') }}</td>\n </tr>\n </thead>\n\n <tbody>\n @for (application of applications ?? []; track application) {\n <tr>\n <td>\n @if (application.effectiveUrl) {\n <a [href]=\"application.effectiveUrl\">\n @if (application.client.name) {\n {{ i18n.advancedMsgStr(application.client.name) }}\n } @else {\n {{ application.client.clientId }}\n }\n </a>\n } @else {\n @if (application.client.name) {\n {{ i18n.advancedMsgStr(application.client.name) }}\n } @else {\n {{ application.client.clientId }}\n }\n }\n </td>\n\n <td>\n @if (!(application.realmRolesAvailable | isArrayWithEmptyObject)) {\n @for (role of application.realmRolesAvailable; track role; let last = $last) {\n <span>\n @if (role.description) {\n {{ i18n.advancedMsgStr(role.description) }}\n } @else {\n {{ i18n.advancedMsgStr(role.name) }}\n }\n @if (!last) {\n ,&nbsp;\n }\n </span>\n }\n }\n @if (application.resourceRolesAvailable) {\n @for (resource of application.resourceRolesAvailable | keyvalue; track resource.key) {\n <span>\n @if (!(application.realmRolesAvailable | isArrayWithEmptyObject)) {\n ,&nbsp;\n }\n @for (\n clientRole of application.resourceRolesAvailable[resource.key];\n track clientRole;\n let roleLast = $last\n ) {\n <span>\n {{\n i18n.advancedMsgStr(clientRole.roleDescription ? clientRole.roleDescription : clientRole.roleName)\n }}\n {{ i18n.msgStr('inResource') }}\n <strong>\n {{\n clientRole.clientName ? i18n.advancedMsgStr(clientRole.clientName) : clientRole.clientId\n }}</strong\n >\n @if (!roleLast) {\n ,&nbsp;\n }\n </span>\n }\n </span>\n }\n }\n </td>\n\n <td>\n @if (application.client.consentRequired) {\n @for (claim of application.clientScopesGranted; track claim; let last = $last) {\n {{ i18n.advancedMsgStr(claim) }}\n @if (!last) {\n ,&nbsp;\n }\n }\n } @else {\n <strong>{{ i18n.msgStr('fullAccess') }}</strong>\n }\n </td>\n\n <td>\n @for (grant of application.additionalGrants; track grant; let last = $last) {\n {{ i18n.advancedMsgStr(grant) }}\n @if (!last) {\n ,&nbsp;\n }\n }\n </td>\n\n <td>\n @if (\n (application.client.consentRequired && application.clientScopesGranted.length > 0) ||\n application.additionalGrants.length > 0\n ) {\n <button\n type=\"submit\"\n name=\"clientId\"\n [kcClass]=\"['kcButtonPrimaryClass', 'kcButtonClass']\"\n [id]=\"'revoke-' + application.client.clientId\"\n [value]=\"application.client.id\"\n >\n {{ i18n.msgStr('revoke') }}\n </button>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n </form>\n</div>\n", dependencies: [{ kind: "directive", type: KcClassDirective, selector: "[kcClass]", inputs: ["class", "ngClass", "kcClass"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: IsArrayWithEmptyObjectPipe, name: "isArrayWithEmptyObject" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
28
28
  }
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: ApplicationsComponent, decorators: [{
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ApplicationsComponent, decorators: [{
30
30
  type: Component,
31
31
  args: [{ imports: [KcClassDirective, KeyValuePipe, IsArrayWithEmptyObjectPipe], selector: 'kc-applications', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
32
32
  {