keycloakify 11.3.1 → 11.3.3

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.
package/README.md CHANGED
@@ -43,6 +43,11 @@
43
43
 
44
44
  Keycloakify is fully compatible with Keycloak from version 11 to 26...[and beyond](https://github.com/keycloakify/keycloakify/discussions/346#discussioncomment-5889791)
45
45
 
46
+ > 📣 **Keycloakify 26 Released**
47
+ > Themes built with Keycloakify versions **prior** to Keycloak 26 are **incompatible** with Keycloak 26.
48
+ > To ensure compatibility, simply upgrade to the latest Keycloakify version for your major release (v10 or v11) and rebuild your theme.
49
+ > No breaking changes have been introduced, but the target version ranges have been updated. For more details, see [this guide](https://docs.keycloakify.dev/targeting-specific-keycloak-versions).
50
+
46
51
  ## Sponsors
47
52
 
48
53
  Friends for the project, we trust and recommend their services.
@@ -1,36 +1,25 @@
1
1
  "use strict";
2
- exports.id = 193;
3
- exports.ids = [193];
2
+ exports.id = 40;
3
+ exports.ids = [40];
4
4
  exports.modules = {
5
5
 
6
- /***/ 23193:
6
+ /***/ 18040:
7
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
8
 
9
- // ESM COMPAT FLAG
10
9
  __webpack_require__.r(__webpack_exports__);
11
-
12
- // EXPORTS
13
- __webpack_require__.d(__webpack_exports__, {
14
- "command": () => (/* binding */ command)
15
- });
16
-
17
- // EXTERNAL MODULE: external "path"
18
- var external_path_ = __webpack_require__(71017);
19
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
20
- var constants = __webpack_require__(173);
21
- // EXTERNAL MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
22
- var readThisNpmPackageVersion = __webpack_require__(64795);
23
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
24
- var assert = __webpack_require__(29041);
25
- // EXTERNAL MODULE: external "fs"
26
- var external_fs_ = __webpack_require__(57147);
27
- // EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
28
- var fs_rmSync = __webpack_require__(89693);
29
- // EXTERNAL MODULE: ./dist/bin/tools/transformCodebase.js
30
- var transformCodebase = __webpack_require__(60332);
31
- // EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
32
- var getThisCodebaseRootDirPath = __webpack_require__(58822);
33
- ;// CONCATENATED MODULE: ./dist/bin/shared/copyKeycloakResourcesToPublic.js
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "command": () => (/* binding */ command)
12
+ /* harmony export */ });
13
+ /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72138);
14
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
15
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
16
+ /* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(173);
17
+ /* harmony import */ var _tools_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(64795);
18
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57147);
19
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__);
20
+ /* harmony import */ var _tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(89693);
21
+ /* harmony import */ var _tools_transformCodebase__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60332);
22
+ /* harmony import */ var _tools_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(58822);
34
23
 
35
24
 
36
25
 
@@ -39,65 +28,55 @@ var getThisCodebaseRootDirPath = __webpack_require__(58822);
39
28
 
40
29
 
41
30
 
42
- (0,assert/* assert */.h)();
43
- function copyKeycloakResourcesToPublic(params) {
31
+ async function command(params) {
44
32
  const { buildContext } = params;
45
- const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */.Ju.KEYCLOAKIFY_DEV_RESOURCES);
46
- const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
33
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__/* .maybeDelegateCommandToCustomHandler */ .q)({
34
+ commandName: "copy-keycloak-resources-to-public",
35
+ buildContext
36
+ });
37
+ if (hasBeenHandled) {
38
+ return;
39
+ }
40
+ const destDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */ .Ju.KEYCLOAKIFY_DEV_RESOURCES);
41
+ const keycloakifyBuildinfoFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(destDirPath, "keycloakify.buildinfo");
47
42
  const keycloakifyBuildinfoRaw = JSON.stringify({
48
- keycloakifyVersion: (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)()
43
+ keycloakifyVersion: (0,_tools_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_3__/* .readThisNpmPackageVersion */ .K)()
49
44
  }, null, 2);
50
45
  skip_if_already_done: {
51
- if (!external_fs_.existsSync(keycloakifyBuildinfoFilePath)) {
46
+ if (!fs__WEBPACK_IMPORTED_MODULE_4__.existsSync(keycloakifyBuildinfoFilePath)) {
52
47
  break skip_if_already_done;
53
48
  }
54
- const keycloakifyBuildinfoRaw_previousRun = external_fs_.readFileSync(keycloakifyBuildinfoFilePath)
49
+ const keycloakifyBuildinfoRaw_previousRun = fs__WEBPACK_IMPORTED_MODULE_4__.readFileSync(keycloakifyBuildinfoFilePath)
55
50
  .toString("utf8");
56
51
  if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
57
52
  break skip_if_already_done;
58
53
  }
59
54
  return;
60
55
  }
61
- (0,fs_rmSync/* rmSync */.a)(destDirPath, { force: true, recursive: true });
56
+ (0,_tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_5__/* .rmSync */ .a)(destDirPath, { force: true, recursive: true });
62
57
  // NOTE: To remove in a while, remove the legacy keycloak-resources directory
63
- (0,fs_rmSync/* rmSync */.a)((0,external_path_.join)((0,external_path_.dirname)(destDirPath), "keycloak-resources"), {
58
+ (0,_tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_5__/* .rmSync */ .a)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(destDirPath), "keycloak-resources"), {
64
59
  force: true,
65
60
  recursive: true
66
61
  });
67
- (0,fs_rmSync/* rmSync */.a)((0,external_path_.join)((0,external_path_.dirname)(destDirPath), ".keycloakify"), {
62
+ (0,_tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_5__/* .rmSync */ .a)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(destDirPath), ".keycloakify"), {
68
63
  force: true,
69
64
  recursive: true
70
65
  });
71
- external_fs_.mkdirSync(destDirPath, { recursive: true });
72
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
73
- (0,transformCodebase/* transformCodebase */.N)({
74
- srcDirPath: (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "res", "public", constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */.Ju.KEYCLOAKIFY_DEV_RESOURCES),
66
+ fs__WEBPACK_IMPORTED_MODULE_4__.mkdirSync(destDirPath, { recursive: true });
67
+ fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
68
+ (0,_tools_transformCodebase__WEBPACK_IMPORTED_MODULE_6__/* .transformCodebase */ .N)({
69
+ srcDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_tools_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_7__/* .getThisCodebaseRootDirPath */ .e)(), "res", "public", _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */ .Ju.KEYCLOAKIFY_DEV_RESOURCES),
75
70
  destDirPath
76
71
  });
77
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
72
+ fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(destDirPath, "README.txt"), Buffer.from(
78
73
  // prettier-ignore
79
74
  [
80
75
  "This directory is only used in dev mode by Keycloakify",
81
76
  "It won't be included in your final build.",
82
77
  "Do not modify anything in this directory.",
83
78
  ].join("\n")));
84
- external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
85
- }
86
- //# sourceMappingURL=copyKeycloakResourcesToPublic.js.map
87
- // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
88
- var customHandler_delegate = __webpack_require__(72138);
89
- ;// CONCATENATED MODULE: ./dist/bin/copy-keycloak-resources-to-public.js
90
-
91
-
92
- async function command(params) {
93
- const { buildContext } = params;
94
- (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
95
- commandName: "copy-keycloak-resources-to-public",
96
- buildContext
97
- });
98
- copyKeycloakResourcesToPublic({
99
- buildContext
100
- });
79
+ fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
101
80
  }
102
81
  //# sourceMappingURL=copy-keycloak-resources-to-public.js.map
103
82
 
@@ -154,7 +133,7 @@ var external_fs_ = __webpack_require__(57147);
154
133
  function maybeDelegateCommandToCustomHandler(params) {
155
134
  const { commandName, buildContext } = params;
156
135
  if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
157
- return;
136
+ return { hasBeenHandled: false };
158
137
  }
159
138
  try {
160
139
  external_child_process_.execSync(`npx ${BIN_NAME}`, {
@@ -165,11 +144,11 @@ function maybeDelegateCommandToCustomHandler(params) {
165
144
  catch (error) {
166
145
  const status = error.status;
167
146
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
168
- return;
147
+ return { hasBeenHandled: false };
169
148
  }
170
149
  process.exit(status);
171
150
  }
172
- process.exit(0);
151
+ return { hasBeenHandled: true };
173
152
  }
174
153
  //# sourceMappingURL=customHandler_delegate.js.map
175
154
 
package/bin/453.index.js CHANGED
@@ -36,10 +36,13 @@ __webpack_require__.r(__webpack_exports__);
36
36
 
37
37
  async function command(params) {
38
38
  const { buildContext } = params;
39
- (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_7__/* .maybeDelegateCommandToCustomHandler */ .q)({
39
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_7__/* .maybeDelegateCommandToCustomHandler */ .q)({
40
40
  commandName: "eject-page",
41
41
  buildContext
42
42
  });
43
+ if (hasBeenHandled) {
44
+ return;
45
+ }
43
46
  console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().cyan("Theme type:"));
44
47
  const themeType = await (async () => {
45
48
  const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
@@ -283,7 +286,7 @@ var external_fs_ = __webpack_require__(57147);
283
286
  function maybeDelegateCommandToCustomHandler(params) {
284
287
  const { commandName, buildContext } = params;
285
288
  if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
286
- return;
289
+ return { hasBeenHandled: false };
287
290
  }
288
291
  try {
289
292
  external_child_process_.execSync(`npx ${BIN_NAME}`, {
@@ -294,11 +297,11 @@ function maybeDelegateCommandToCustomHandler(params) {
294
297
  catch (error) {
295
298
  const status = error.status;
296
299
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
297
- return;
300
+ return { hasBeenHandled: false };
298
301
  }
299
302
  process.exit(status);
300
303
  }
301
- process.exit(0);
304
+ return { hasBeenHandled: true };
302
305
  }
303
306
  //# sourceMappingURL=customHandler_delegate.js.map
304
307
 
package/bin/780.index.js CHANGED
@@ -98,10 +98,13 @@ var customHandler_delegate = __webpack_require__(72138);
98
98
 
99
99
  async function command(params) {
100
100
  const { buildContext } = params;
101
- (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
101
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
102
102
  commandName: "initialize-account-theme",
103
103
  buildContext
104
104
  });
105
+ if (hasBeenHandled) {
106
+ return;
107
+ }
105
108
  const accountThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "account");
106
109
  if (external_fs_.existsSync(accountThemeSrcDirPath) &&
107
110
  external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
@@ -222,7 +225,7 @@ var external_fs_ = __webpack_require__(57147);
222
225
  function maybeDelegateCommandToCustomHandler(params) {
223
226
  const { commandName, buildContext } = params;
224
227
  if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
225
- return;
228
+ return { hasBeenHandled: false };
226
229
  }
227
230
  try {
228
231
  external_child_process_.execSync(`npx ${BIN_NAME}`, {
@@ -233,11 +236,11 @@ function maybeDelegateCommandToCustomHandler(params) {
233
236
  catch (error) {
234
237
  const status = error.status;
235
238
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
236
- return;
239
+ return { hasBeenHandled: false };
237
240
  }
238
241
  process.exit(status);
239
242
  }
240
- process.exit(0);
243
+ return { hasBeenHandled: true };
241
244
  }
242
245
  //# sourceMappingURL=customHandler_delegate.js.map
243
246
 
@@ -286,10 +289,13 @@ __webpack_require__.r(__webpack_exports__);
286
289
 
287
290
  async function command(params) {
288
291
  const { buildContext } = params;
289
- (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
292
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
290
293
  commandName: "update-kc-gen",
291
294
  buildContext
292
295
  });
296
+ if (hasBeenHandled) {
297
+ return;
298
+ }
293
299
  const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
294
300
  const currentContent = (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))
295
301
  ? await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)
package/bin/786.index.js CHANGED
@@ -54,7 +54,7 @@ var external_fs_ = __webpack_require__(57147);
54
54
  function maybeDelegateCommandToCustomHandler(params) {
55
55
  const { commandName, buildContext } = params;
56
56
  if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
57
- return;
57
+ return { hasBeenHandled: false };
58
58
  }
59
59
  try {
60
60
  external_child_process_.execSync(`npx ${BIN_NAME}`, {
@@ -65,11 +65,11 @@ function maybeDelegateCommandToCustomHandler(params) {
65
65
  catch (error) {
66
66
  const status = error.status;
67
67
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
68
- return;
68
+ return { hasBeenHandled: false };
69
69
  }
70
70
  process.exit(status);
71
71
  }
72
- process.exit(0);
72
+ return { hasBeenHandled: true };
73
73
  }
74
74
  //# sourceMappingURL=customHandler_delegate.js.map
75
75
 
@@ -118,10 +118,13 @@ __webpack_require__.r(__webpack_exports__);
118
118
 
119
119
  async function command(params) {
120
120
  const { buildContext } = params;
121
- (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
121
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
122
122
  commandName: "update-kc-gen",
123
123
  buildContext
124
124
  });
125
+ if (hasBeenHandled) {
126
+ return;
127
+ }
125
128
  const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
126
129
  const currentContent = (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))
127
130
  ? await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)
package/bin/932.index.js CHANGED
@@ -26,10 +26,13 @@ __webpack_require__.r(__webpack_exports__);
26
26
 
27
27
  async function command(params) {
28
28
  const { buildContext } = params;
29
- (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_5__/* .maybeDelegateCommandToCustomHandler */ .q)({
29
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_5__/* .maybeDelegateCommandToCustomHandler */ .q)({
30
30
  commandName: "initialize-email-theme",
31
31
  buildContext
32
32
  });
33
+ if (hasBeenHandled) {
34
+ return;
35
+ }
33
36
  const emailThemeSrcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(buildContext.themeSrcDirPath, "email");
34
37
  if (fs__WEBPACK_IMPORTED_MODULE_3__.existsSync(emailThemeSrcDirPath) &&
35
38
  fs__WEBPACK_IMPORTED_MODULE_3__.readdirSync(emailThemeSrcDirPath).length > 0) {
@@ -126,7 +129,7 @@ var external_fs_ = __webpack_require__(57147);
126
129
  function maybeDelegateCommandToCustomHandler(params) {
127
130
  const { commandName, buildContext } = params;
128
131
  if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
129
- return;
132
+ return { hasBeenHandled: false };
130
133
  }
131
134
  try {
132
135
  external_child_process_.execSync(`npx ${BIN_NAME}`, {
@@ -137,11 +140,11 @@ function maybeDelegateCommandToCustomHandler(params) {
137
140
  catch (error) {
138
141
  const status = error.status;
139
142
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
140
- return;
143
+ return { hasBeenHandled: false };
141
144
  }
142
145
  process.exit(status);
143
146
  }
144
- process.exit(0);
147
+ return { hasBeenHandled: true };
145
148
  }
146
149
  //# sourceMappingURL=customHandler_delegate.js.map
147
150
 
package/bin/main.js CHANGED
@@ -16244,7 +16244,7 @@ program
16244
16244
  });
16245
16245
  program
16246
16246
  .command({
16247
- name: "initialize-login-theme",
16247
+ name: "initialize-email-theme",
16248
16248
  description: "Initialize an email theme."
16249
16249
  })
16250
16250
  .task({
@@ -16274,7 +16274,7 @@ program
16274
16274
  .task({
16275
16275
  skip,
16276
16276
  handler: async ({ projectDirPath }) => {
16277
- const { command } = await __nccwpck_require__.e(/* import() */ 193).then(__nccwpck_require__.bind(__nccwpck_require__, 23193));
16277
+ const { command } = await __nccwpck_require__.e(/* import() */ 40).then(__nccwpck_require__.bind(__nccwpck_require__, 18040));
16278
16278
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16279
16279
  }
16280
16280
  });
@@ -3,4 +3,6 @@ import { type CommandName } from "./customHandler";
3
3
  export declare function maybeDelegateCommandToCustomHandler(params: {
4
4
  commandName: CommandName;
5
5
  buildContext: BuildContext;
6
- }): void;
6
+ }): {
7
+ hasBeenHandled: boolean;
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.3.1",
3
+ "version": "11.3.3",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -677,7 +677,6 @@
677
677
  "src/bin/shared/KeycloakVersionRange.ts",
678
678
  "src/bin/shared/buildContext.ts",
679
679
  "src/bin/shared/constants.ts",
680
- "src/bin/shared/copyKeycloakResourcesToPublic.ts",
681
680
  "src/bin/shared/customHandler.ts",
682
681
  "src/bin/shared/customHandler_delegate.ts",
683
682
  "src/bin/shared/getLatestsSemVersionedTag.ts",
@@ -1011,7 +1010,6 @@
1011
1010
  "bin/main.d.ts",
1012
1011
  "bin/shared/buildContext.d.ts",
1013
1012
  "bin/shared/constants.d.ts",
1014
- "bin/shared/copyKeycloakResourcesToPublic.d.ts",
1015
1013
  "bin/shared/customHandler_delegate.d.ts",
1016
1014
  "bin/shared/customHandler.d.ts",
1017
1015
  "bin/shared/getLatestsSemVersionedTag.d.ts",
@@ -1050,12 +1048,12 @@
1050
1048
  "bin/tools/trimIndent.d.ts",
1051
1049
  "bin/update-kc-gen.d.ts",
1052
1050
  "bin/main.js",
1053
- "bin/193.index.js",
1054
1051
  "bin/20.index.js",
1055
1052
  "bin/266.index.js",
1056
1053
  "bin/304.index.js",
1057
1054
  "bin/33.index.js",
1058
1055
  "bin/36.index.js",
1056
+ "bin/40.index.js",
1059
1057
  "bin/453.index.js",
1060
1058
  "bin/526.index.js",
1061
1059
  "bin/573.index.js",
@@ -1,16 +1,96 @@
1
- import { copyKeycloakResourcesToPublic } from "./shared/copyKeycloakResourcesToPublic";
2
- import type { BuildContext } from "./shared/buildContext";
3
1
  import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_delegate";
2
+ import { join as pathJoin, dirname as pathDirname } from "path";
3
+ import { WELL_KNOWN_DIRECTORY_BASE_NAME } from "./shared/constants";
4
+ import { readThisNpmPackageVersion } from "./tools/readThisNpmPackageVersion";
5
+ import * as fs from "fs";
6
+ import { rmSync } from "./tools/fs.rmSync";
7
+ import type { BuildContext } from "./shared/buildContext";
8
+ import { transformCodebase } from "./tools/transformCodebase";
9
+ import { getThisCodebaseRootDirPath } from "./tools/getThisCodebaseRootDirPath";
4
10
 
5
11
  export async function command(params: { buildContext: BuildContext }) {
6
12
  const { buildContext } = params;
7
13
 
8
- maybeDelegateCommandToCustomHandler({
14
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
9
15
  commandName: "copy-keycloak-resources-to-public",
10
16
  buildContext
11
17
  });
12
18
 
13
- copyKeycloakResourcesToPublic({
14
- buildContext
19
+ if (hasBeenHandled) {
20
+ return;
21
+ }
22
+
23
+ const destDirPath = pathJoin(
24
+ buildContext.publicDirPath,
25
+ WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
26
+ );
27
+
28
+ const keycloakifyBuildinfoFilePath = pathJoin(destDirPath, "keycloakify.buildinfo");
29
+
30
+ const keycloakifyBuildinfoRaw = JSON.stringify(
31
+ {
32
+ keycloakifyVersion: readThisNpmPackageVersion()
33
+ },
34
+ null,
35
+ 2
36
+ );
37
+
38
+ skip_if_already_done: {
39
+ if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
40
+ break skip_if_already_done;
41
+ }
42
+
43
+ const keycloakifyBuildinfoRaw_previousRun = fs
44
+ .readFileSync(keycloakifyBuildinfoFilePath)
45
+ .toString("utf8");
46
+
47
+ if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
48
+ break skip_if_already_done;
49
+ }
50
+
51
+ return;
52
+ }
53
+
54
+ rmSync(destDirPath, { force: true, recursive: true });
55
+
56
+ // NOTE: To remove in a while, remove the legacy keycloak-resources directory
57
+ rmSync(pathJoin(pathDirname(destDirPath), "keycloak-resources"), {
58
+ force: true,
59
+ recursive: true
60
+ });
61
+ rmSync(pathJoin(pathDirname(destDirPath), ".keycloakify"), {
62
+ force: true,
63
+ recursive: true
15
64
  });
65
+
66
+ fs.mkdirSync(destDirPath, { recursive: true });
67
+
68
+ fs.writeFileSync(pathJoin(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
69
+
70
+ transformCodebase({
71
+ srcDirPath: pathJoin(
72
+ getThisCodebaseRootDirPath(),
73
+ "res",
74
+ "public",
75
+ WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
76
+ ),
77
+ destDirPath
78
+ });
79
+
80
+ fs.writeFileSync(
81
+ pathJoin(destDirPath, "README.txt"),
82
+ Buffer.from(
83
+ // prettier-ignore
84
+ [
85
+ "This directory is only used in dev mode by Keycloakify",
86
+ "It won't be included in your final build.",
87
+ "Do not modify anything in this directory.",
88
+ ].join("\n")
89
+ )
90
+ );
91
+
92
+ fs.writeFileSync(
93
+ keycloakifyBuildinfoFilePath,
94
+ Buffer.from(keycloakifyBuildinfoRaw, "utf8")
95
+ );
16
96
  }
@@ -27,11 +27,15 @@ import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_dele
27
27
  export async function command(params: { buildContext: BuildContext }) {
28
28
  const { buildContext } = params;
29
29
 
30
- maybeDelegateCommandToCustomHandler({
30
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
31
31
  commandName: "eject-page",
32
32
  buildContext
33
33
  });
34
34
 
35
+ if (hasBeenHandled) {
36
+ return;
37
+ }
38
+
35
39
  console.log(chalk.cyan("Theme type:"));
36
40
 
37
41
  const themeType = await (async () => {
@@ -11,11 +11,15 @@ import { maybeDelegateCommandToCustomHandler } from "../shared/customHandler_del
11
11
  export async function command(params: { buildContext: BuildContext }) {
12
12
  const { buildContext } = params;
13
13
 
14
- maybeDelegateCommandToCustomHandler({
14
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
15
15
  commandName: "initialize-account-theme",
16
16
  buildContext
17
17
  });
18
18
 
19
+ if (hasBeenHandled) {
20
+ return;
21
+ }
22
+
19
23
  const accountThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "account");
20
24
 
21
25
  if (
@@ -9,11 +9,15 @@ import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_dele
9
9
  export async function command(params: { buildContext: BuildContext }) {
10
10
  const { buildContext } = params;
11
11
 
12
- maybeDelegateCommandToCustomHandler({
12
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
13
13
  commandName: "initialize-email-theme",
14
14
  buildContext
15
15
  });
16
16
 
17
+ if (hasBeenHandled) {
18
+ return;
19
+ }
20
+
17
21
  const emailThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "email");
18
22
 
19
23
  if (
package/src/bin/main.ts CHANGED
@@ -171,7 +171,7 @@ program
171
171
 
172
172
  program
173
173
  .command({
174
- name: "initialize-login-theme",
174
+ name: "initialize-email-theme",
175
175
  description: "Initialize an email theme."
176
176
  })
177
177
  .task({
@@ -16,11 +16,11 @@ assert<Equals<ApiVersion, "v1">>();
16
16
  export function maybeDelegateCommandToCustomHandler(params: {
17
17
  commandName: CommandName;
18
18
  buildContext: BuildContext;
19
- }) {
19
+ }): { hasBeenHandled: boolean } {
20
20
  const { commandName, buildContext } = params;
21
21
 
22
22
  if (!fs.readdirSync(pathDirname(process.argv[1])).includes(BIN_NAME)) {
23
- return;
23
+ return { hasBeenHandled: false };
24
24
  }
25
25
 
26
26
  try {
@@ -36,11 +36,11 @@ export function maybeDelegateCommandToCustomHandler(params: {
36
36
  const status = error.status;
37
37
 
38
38
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
39
- return;
39
+ return { hasBeenHandled: false };
40
40
  }
41
41
 
42
42
  process.exit(status);
43
43
  }
44
44
 
45
- process.exit(0);
45
+ return { hasBeenHandled: true };
46
46
  }
@@ -7,11 +7,15 @@ import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_dele
7
7
  export async function command(params: { buildContext: BuildContext }) {
8
8
  const { buildContext } = params;
9
9
 
10
- maybeDelegateCommandToCustomHandler({
10
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
11
11
  commandName: "update-kc-gen",
12
12
  buildContext
13
13
  });
14
14
 
15
+ if (hasBeenHandled) {
16
+ return;
17
+ }
18
+
15
19
  const filePath = pathJoin(buildContext.themeSrcDirPath, `kc.gen.tsx`);
16
20
 
17
21
  const currentContent = (await existsAsync(filePath))
@@ -6,7 +6,7 @@ import {
6
6
  } from "../bin/shared/constants";
7
7
  import { id } from "tsafe/id";
8
8
  import { rm } from "../bin/tools/fs.rm";
9
- import { copyKeycloakResourcesToPublic } from "../bin/shared/copyKeycloakResourcesToPublic";
9
+ import { command as copyKeycloakResourcesToPublicCommand } from "../bin/copy-keycloak-resources-to-public";
10
10
  import { assert } from "tsafe/assert";
11
11
  import {
12
12
  getBuildContext,
@@ -125,7 +125,7 @@ export function keycloakify(params: keycloakify.Params) {
125
125
  projectDirPath
126
126
  });
127
127
 
128
- copyKeycloakResourcesToPublic({ buildContext });
128
+ await copyKeycloakResourcesToPublicCommand({ buildContext });
129
129
 
130
130
  await updateKcGenCommand({ buildContext });
131
131
  },
@@ -1,6 +1,208 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
+ /***/ 721:
5
+ /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
+
7
+ "use strict";
8
+ // ESM COMPAT FLAG
9
+ __nccwpck_require__.r(__webpack_exports__);
10
+
11
+ // EXPORTS
12
+ __nccwpck_require__.d(__webpack_exports__, {
13
+ "command": () => (/* binding */ command)
14
+ });
15
+
16
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
17
+ var customHandler_delegate = __nccwpck_require__(138);
18
+ // EXTERNAL MODULE: external "path"
19
+ var external_path_ = __nccwpck_require__(17);
20
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
21
+ var constants = __nccwpck_require__(173);
22
+ // EXTERNAL MODULE: external "fs"
23
+ var external_fs_ = __nccwpck_require__(147);
24
+ ;// CONCATENATED MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
25
+
26
+
27
+ function getThisCodebaseRootDirPath_rec(dirPath) {
28
+ if (external_fs_.existsSync(external_path_.join(dirPath, "package.json"))) {
29
+ return dirPath;
30
+ }
31
+ return getThisCodebaseRootDirPath_rec(external_path_.join(dirPath, ".."));
32
+ }
33
+ let result = undefined;
34
+ function getThisCodebaseRootDirPath() {
35
+ if (result !== undefined) {
36
+ return result;
37
+ }
38
+ return (result = getThisCodebaseRootDirPath_rec(__dirname));
39
+ }
40
+ //# sourceMappingURL=getThisCodebaseRootDirPath.js.map
41
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
42
+ var assert = __nccwpck_require__(41);
43
+ ;// CONCATENATED MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
44
+
45
+
46
+
47
+
48
+ function readThisNpmPackageVersion() {
49
+ const version = JSON.parse(external_fs_.readFileSync((0,external_path_.join)(getThisCodebaseRootDirPath(), "package.json"))
50
+ .toString("utf8"))["version"];
51
+ (0,assert/* assert */.h)(typeof version === "string");
52
+ return version;
53
+ }
54
+ //# sourceMappingURL=readThisNpmPackageVersion.js.map
55
+ // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
56
+ var SemVer = __nccwpck_require__(171);
57
+ ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rmSync.js
58
+
59
+
60
+
61
+ /**
62
+ * Polyfill of fs.rmSync(dirPath, { "recursive": true })
63
+ * For older version of Node
64
+ */
65
+ function rmSync(dirPath, options) {
66
+ if (SemVer/* SemVer.compare */.h.compare(SemVer/* SemVer.parse */.h.parse(process.version), SemVer/* SemVer.parse */.h.parse("14.14.0")) > 0) {
67
+ external_fs_.rmSync(dirPath, options);
68
+ return;
69
+ }
70
+ const { force = true } = options;
71
+ if (force && !external_fs_.existsSync(dirPath)) {
72
+ return;
73
+ }
74
+ const removeDir_rec = (dirPath) => external_fs_.readdirSync(dirPath).forEach(basename => {
75
+ const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
76
+ if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
77
+ removeDir_rec(fileOrDirPath);
78
+ return;
79
+ }
80
+ else {
81
+ external_fs_.unlinkSync(fileOrDirPath);
82
+ }
83
+ });
84
+ removeDir_rec(dirPath);
85
+ }
86
+ //# sourceMappingURL=fs.rmSync.js.map
87
+ // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
88
+ var crawl = __nccwpck_require__(36);
89
+ ;// CONCATENATED MODULE: ./dist/bin/tools/transformCodebase.js
90
+
91
+
92
+
93
+
94
+ /**
95
+ * Apply a transformation function to every file of directory
96
+ * If source and destination are the same this function can be used to apply the transformation in place
97
+ * like filtering out some files or modifying them.
98
+ * */
99
+ function transformCodebase(params) {
100
+ const { srcDirPath, transformSourceCode } = params;
101
+ const isTargetSameAsSource = external_path_.relative(srcDirPath, params.destDirPath) === "";
102
+ const destDirPath = isTargetSameAsSource
103
+ ? external_path_.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
104
+ : params.destDirPath;
105
+ external_fs_.mkdirSync(destDirPath, {
106
+ recursive: true
107
+ });
108
+ for (const fileRelativePath of (0,crawl/* crawl */.J)({
109
+ dirPath: srcDirPath,
110
+ returnedPathsType: "relative to dirPath"
111
+ })) {
112
+ const filePath = external_path_.join(srcDirPath, fileRelativePath);
113
+ const destFilePath = external_path_.join(destDirPath, fileRelativePath);
114
+ // NOTE: Optimization, if we don't need to transform the file, just copy
115
+ // it using the lower level implementation.
116
+ if (transformSourceCode === undefined) {
117
+ external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
118
+ recursive: true
119
+ });
120
+ external_fs_.copyFileSync(filePath, destFilePath);
121
+ continue;
122
+ }
123
+ const transformSourceCodeResult = transformSourceCode({
124
+ sourceCode: external_fs_.readFileSync(filePath),
125
+ filePath,
126
+ fileRelativePath
127
+ });
128
+ if (transformSourceCodeResult === undefined) {
129
+ continue;
130
+ }
131
+ external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
132
+ recursive: true
133
+ });
134
+ const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
135
+ external_fs_.writeFileSync(external_path_.join(external_path_.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : external_path_.basename(destFilePath)), modifiedSourceCode);
136
+ }
137
+ if (isTargetSameAsSource) {
138
+ rmSync(srcDirPath, { recursive: true });
139
+ external_fs_.renameSync(destDirPath, srcDirPath);
140
+ }
141
+ }
142
+ //# sourceMappingURL=transformCodebase.js.map
143
+ ;// CONCATENATED MODULE: ./dist/bin/copy-keycloak-resources-to-public.js
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ async function command(params) {
153
+ const { buildContext } = params;
154
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
155
+ commandName: "copy-keycloak-resources-to-public",
156
+ buildContext
157
+ });
158
+ if (hasBeenHandled) {
159
+ return;
160
+ }
161
+ const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES);
162
+ const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
163
+ const keycloakifyBuildinfoRaw = JSON.stringify({
164
+ keycloakifyVersion: readThisNpmPackageVersion()
165
+ }, null, 2);
166
+ skip_if_already_done: {
167
+ if (!external_fs_.existsSync(keycloakifyBuildinfoFilePath)) {
168
+ break skip_if_already_done;
169
+ }
170
+ const keycloakifyBuildinfoRaw_previousRun = external_fs_.readFileSync(keycloakifyBuildinfoFilePath)
171
+ .toString("utf8");
172
+ if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
173
+ break skip_if_already_done;
174
+ }
175
+ return;
176
+ }
177
+ rmSync(destDirPath, { force: true, recursive: true });
178
+ // NOTE: To remove in a while, remove the legacy keycloak-resources directory
179
+ rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), "keycloak-resources"), {
180
+ force: true,
181
+ recursive: true
182
+ });
183
+ rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), ".keycloakify"), {
184
+ force: true,
185
+ recursive: true
186
+ });
187
+ external_fs_.mkdirSync(destDirPath, { recursive: true });
188
+ external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
189
+ transformCodebase({
190
+ srcDirPath: (0,external_path_.join)(getThisCodebaseRootDirPath(), "res", "public", constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES),
191
+ destDirPath
192
+ });
193
+ external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
194
+ // prettier-ignore
195
+ [
196
+ "This directory is only used in dev mode by Keycloakify",
197
+ "It won't be included in your final build.",
198
+ "Do not modify anything in this directory.",
199
+ ].join("\n")));
200
+ external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
201
+ }
202
+ //# sourceMappingURL=copy-keycloak-resources-to-public.js.map
203
+
204
+ /***/ }),
205
+
4
206
  /***/ 2:
5
207
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
208
 
@@ -4857,197 +5059,76 @@ const CUSTOM_HANDLER_ENV_NAMES = {
4857
5059
 
4858
5060
  /***/ }),
4859
5061
 
4860
- /***/ 601:
5062
+ /***/ 138:
4861
5063
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4862
5064
 
4863
5065
  "use strict";
4864
- // ESM COMPAT FLAG
4865
- __nccwpck_require__.r(__webpack_exports__);
4866
5066
 
4867
5067
  // EXPORTS
4868
5068
  __nccwpck_require__.d(__webpack_exports__, {
4869
- "copyKeycloakResourcesToPublic": () => (/* binding */ copyKeycloakResourcesToPublic)
5069
+ "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
4870
5070
  });
4871
5071
 
4872
- // EXTERNAL MODULE: external "path"
4873
- var external_path_ = __nccwpck_require__(17);
5072
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
5073
+ var esm_assert = __nccwpck_require__(41);
4874
5074
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
4875
5075
  var constants = __nccwpck_require__(173);
4876
- // EXTERNAL MODULE: external "fs"
4877
- var external_fs_ = __nccwpck_require__(147);
4878
- ;// CONCATENATED MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
5076
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
4879
5077
 
4880
5078
 
4881
- function getThisCodebaseRootDirPath_rec(dirPath) {
4882
- if (external_fs_.existsSync(external_path_.join(dirPath, "package.json"))) {
4883
- return dirPath;
4884
- }
4885
- return getThisCodebaseRootDirPath_rec(external_path_.join(dirPath, ".."));
4886
- }
4887
- let result = undefined;
4888
- function getThisCodebaseRootDirPath() {
4889
- if (result !== undefined) {
4890
- return result;
4891
- }
4892
- return (result = getThisCodebaseRootDirPath_rec(__dirname));
5079
+ const BIN_NAME = "_keycloakify-custom-handler";
5080
+ const NOT_IMPLEMENTED_EXIT_CODE = 78;
5081
+ function readParams(params) {
5082
+ const { apiVersion } = params;
5083
+ assert(apiVersion === "v1");
5084
+ const commandName = (() => {
5085
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
5086
+ assert(envValue !== undefined);
5087
+ return envValue;
5088
+ })();
5089
+ const buildContext = (() => {
5090
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
5091
+ assert(envValue !== undefined);
5092
+ return JSON.parse(envValue);
5093
+ })();
5094
+ return { commandName, buildContext };
4893
5095
  }
4894
- //# sourceMappingURL=getThisCodebaseRootDirPath.js.map
4895
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
4896
- var assert = __nccwpck_require__(41);
4897
- ;// CONCATENATED MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
4898
-
5096
+ //# sourceMappingURL=customHandler.js.map
5097
+ // EXTERNAL MODULE: external "child_process"
5098
+ var external_child_process_ = __nccwpck_require__(81);
5099
+ // EXTERNAL MODULE: external "path"
5100
+ var external_path_ = __nccwpck_require__(17);
5101
+ // EXTERNAL MODULE: external "fs"
5102
+ var external_fs_ = __nccwpck_require__(147);
5103
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
4899
5104
 
4900
5105
 
4901
5106
 
4902
- function readThisNpmPackageVersion() {
4903
- const version = JSON.parse(external_fs_.readFileSync((0,external_path_.join)(getThisCodebaseRootDirPath(), "package.json"))
4904
- .toString("utf8"))["version"];
4905
- (0,assert/* assert */.h)(typeof version === "string");
4906
- return version;
4907
- }
4908
- //# sourceMappingURL=readThisNpmPackageVersion.js.map
4909
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
4910
- var SemVer = __nccwpck_require__(171);
4911
- ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rmSync.js
4912
5107
 
4913
5108
 
4914
5109
 
4915
- /**
4916
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
4917
- * For older version of Node
4918
- */
4919
- function rmSync(dirPath, options) {
4920
- if (SemVer/* SemVer.compare */.h.compare(SemVer/* SemVer.parse */.h.parse(process.version), SemVer/* SemVer.parse */.h.parse("14.14.0")) > 0) {
4921
- external_fs_.rmSync(dirPath, options);
4922
- return;
4923
- }
4924
- const { force = true } = options;
4925
- if (force && !external_fs_.existsSync(dirPath)) {
4926
- return;
5110
+ (0,esm_assert/* assert */.h)();
5111
+ function maybeDelegateCommandToCustomHandler(params) {
5112
+ const { commandName, buildContext } = params;
5113
+ if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
5114
+ return { hasBeenHandled: false };
4927
5115
  }
4928
- const removeDir_rec = (dirPath) => external_fs_.readdirSync(dirPath).forEach(basename => {
4929
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
4930
- if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
4931
- removeDir_rec(fileOrDirPath);
4932
- return;
4933
- }
4934
- else {
4935
- external_fs_.unlinkSync(fileOrDirPath);
4936
- }
4937
- });
4938
- removeDir_rec(dirPath);
4939
- }
4940
- //# sourceMappingURL=fs.rmSync.js.map
4941
- // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
4942
- var crawl = __nccwpck_require__(36);
4943
- ;// CONCATENATED MODULE: ./dist/bin/tools/transformCodebase.js
4944
-
4945
-
4946
-
4947
-
4948
- /**
4949
- * Apply a transformation function to every file of directory
4950
- * If source and destination are the same this function can be used to apply the transformation in place
4951
- * like filtering out some files or modifying them.
4952
- * */
4953
- function transformCodebase(params) {
4954
- const { srcDirPath, transformSourceCode } = params;
4955
- const isTargetSameAsSource = external_path_.relative(srcDirPath, params.destDirPath) === "";
4956
- const destDirPath = isTargetSameAsSource
4957
- ? external_path_.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
4958
- : params.destDirPath;
4959
- external_fs_.mkdirSync(destDirPath, {
4960
- recursive: true
4961
- });
4962
- for (const fileRelativePath of (0,crawl/* crawl */.J)({
4963
- dirPath: srcDirPath,
4964
- returnedPathsType: "relative to dirPath"
4965
- })) {
4966
- const filePath = external_path_.join(srcDirPath, fileRelativePath);
4967
- const destFilePath = external_path_.join(destDirPath, fileRelativePath);
4968
- // NOTE: Optimization, if we don't need to transform the file, just copy
4969
- // it using the lower level implementation.
4970
- if (transformSourceCode === undefined) {
4971
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
4972
- recursive: true
4973
- });
4974
- external_fs_.copyFileSync(filePath, destFilePath);
4975
- continue;
4976
- }
4977
- const transformSourceCodeResult = transformSourceCode({
4978
- sourceCode: external_fs_.readFileSync(filePath),
4979
- filePath,
4980
- fileRelativePath
4981
- });
4982
- if (transformSourceCodeResult === undefined) {
4983
- continue;
4984
- }
4985
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
4986
- recursive: true
5116
+ try {
5117
+ external_child_process_.execSync(`npx ${BIN_NAME}`, {
5118
+ stdio: "inherit",
5119
+ env: Object.assign(Object.assign({}, process.env), { [constants.CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME]: commandName, [constants.CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT]: JSON.stringify(buildContext) })
4987
5120
  });
4988
- const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
4989
- external_fs_.writeFileSync(external_path_.join(external_path_.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : external_path_.basename(destFilePath)), modifiedSourceCode);
4990
5121
  }
4991
- if (isTargetSameAsSource) {
4992
- rmSync(srcDirPath, { recursive: true });
4993
- external_fs_.renameSync(destDirPath, srcDirPath);
4994
- }
4995
- }
4996
- //# sourceMappingURL=transformCodebase.js.map
4997
- ;// CONCATENATED MODULE: ./dist/bin/shared/copyKeycloakResourcesToPublic.js
4998
-
4999
-
5000
-
5001
-
5002
-
5003
-
5004
-
5005
-
5006
- (0,assert/* assert */.h)();
5007
- function copyKeycloakResourcesToPublic(params) {
5008
- const { buildContext } = params;
5009
- const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES);
5010
- const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
5011
- const keycloakifyBuildinfoRaw = JSON.stringify({
5012
- keycloakifyVersion: readThisNpmPackageVersion()
5013
- }, null, 2);
5014
- skip_if_already_done: {
5015
- if (!external_fs_.existsSync(keycloakifyBuildinfoFilePath)) {
5016
- break skip_if_already_done;
5017
- }
5018
- const keycloakifyBuildinfoRaw_previousRun = external_fs_.readFileSync(keycloakifyBuildinfoFilePath)
5019
- .toString("utf8");
5020
- if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
5021
- break skip_if_already_done;
5122
+ catch (error) {
5123
+ const status = error.status;
5124
+ if (status === NOT_IMPLEMENTED_EXIT_CODE) {
5125
+ return { hasBeenHandled: false };
5022
5126
  }
5023
- return;
5127
+ process.exit(status);
5024
5128
  }
5025
- rmSync(destDirPath, { force: true, recursive: true });
5026
- // NOTE: To remove in a while, remove the legacy keycloak-resources directory
5027
- rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), "keycloak-resources"), {
5028
- force: true,
5029
- recursive: true
5030
- });
5031
- rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), ".keycloakify"), {
5032
- force: true,
5033
- recursive: true
5034
- });
5035
- external_fs_.mkdirSync(destDirPath, { recursive: true });
5036
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
5037
- transformCodebase({
5038
- srcDirPath: (0,external_path_.join)(getThisCodebaseRootDirPath(), "res", "public", constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES),
5039
- destDirPath
5040
- });
5041
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
5042
- // prettier-ignore
5043
- [
5044
- "This directory is only used in dev mode by Keycloakify",
5045
- "It won't be included in your final build.",
5046
- "Do not modify anything in this directory.",
5047
- ].join("\n")));
5048
- external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
5129
+ return { hasBeenHandled: true };
5049
5130
  }
5050
- //# sourceMappingURL=copyKeycloakResourcesToPublic.js.map
5131
+ //# sourceMappingURL=customHandler_delegate.js.map
5051
5132
 
5052
5133
  /***/ }),
5053
5134
 
@@ -5228,7 +5309,7 @@ async function checkDirExists(dirPath) {
5228
5309
 
5229
5310
  /***/ }),
5230
5311
 
5231
- /***/ 358:
5312
+ /***/ 810:
5232
5313
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
5233
5314
 
5234
5315
  "use strict";
@@ -5258,64 +5339,8 @@ async function existsAsync(path) {
5258
5339
  }
5259
5340
  }
5260
5341
  //# sourceMappingURL=fs.existsAsync.js.map
5261
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
5262
- var esm_assert = __nccwpck_require__(41);
5263
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
5264
- var constants = __nccwpck_require__(173);
5265
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
5266
-
5267
-
5268
- const BIN_NAME = "_keycloakify-custom-handler";
5269
- const NOT_IMPLEMENTED_EXIT_CODE = 78;
5270
- function readParams(params) {
5271
- const { apiVersion } = params;
5272
- assert(apiVersion === "v1");
5273
- const commandName = (() => {
5274
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
5275
- assert(envValue !== undefined);
5276
- return envValue;
5277
- })();
5278
- const buildContext = (() => {
5279
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
5280
- assert(envValue !== undefined);
5281
- return JSON.parse(envValue);
5282
- })();
5283
- return { commandName, buildContext };
5284
- }
5285
- //# sourceMappingURL=customHandler.js.map
5286
- // EXTERNAL MODULE: external "child_process"
5287
- var external_child_process_ = __nccwpck_require__(81);
5288
- // EXTERNAL MODULE: external "fs"
5289
- var external_fs_ = __nccwpck_require__(147);
5290
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
5291
-
5292
-
5293
-
5294
-
5295
-
5296
-
5297
- (0,esm_assert/* assert */.h)();
5298
- function maybeDelegateCommandToCustomHandler(params) {
5299
- const { commandName, buildContext } = params;
5300
- if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
5301
- return;
5302
- }
5303
- try {
5304
- external_child_process_.execSync(`npx ${BIN_NAME}`, {
5305
- stdio: "inherit",
5306
- env: Object.assign(Object.assign({}, process.env), { [constants.CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME]: commandName, [constants.CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT]: JSON.stringify(buildContext) })
5307
- });
5308
- }
5309
- catch (error) {
5310
- const status = error.status;
5311
- if (status === NOT_IMPLEMENTED_EXIT_CODE) {
5312
- return;
5313
- }
5314
- process.exit(status);
5315
- }
5316
- process.exit(0);
5317
- }
5318
- //# sourceMappingURL=customHandler_delegate.js.map
5342
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
5343
+ var customHandler_delegate = __nccwpck_require__(138);
5319
5344
  ;// CONCATENATED MODULE: ./dist/bin/update-kc-gen.js
5320
5345
 
5321
5346
 
@@ -5323,10 +5348,13 @@ function maybeDelegateCommandToCustomHandler(params) {
5323
5348
 
5324
5349
  async function command(params) {
5325
5350
  const { buildContext } = params;
5326
- maybeDelegateCommandToCustomHandler({
5351
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
5327
5352
  commandName: "update-kc-gen",
5328
5353
  buildContext
5329
5354
  });
5355
+ if (hasBeenHandled) {
5356
+ return;
5357
+ }
5330
5358
  const filePath = (0,external_path_.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
5331
5359
  const currentContent = (await existsAsync(filePath))
5332
5360
  ? await promises_.readFile(filePath)
@@ -5453,11 +5481,11 @@ const path_1 = __nccwpck_require__(17);
5453
5481
  const constants_1 = __nccwpck_require__(173);
5454
5482
  const id_1 = __nccwpck_require__(47);
5455
5483
  const fs_rm_1 = __nccwpck_require__(699);
5456
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(601);
5484
+ const copy_keycloak_resources_to_public_1 = __nccwpck_require__(721);
5457
5485
  const assert_1 = __nccwpck_require__(78);
5458
5486
  const buildContext_1 = __nccwpck_require__(2);
5459
5487
  const magic_string_1 = __importDefault(__nccwpck_require__(734));
5460
- const update_kc_gen_1 = __nccwpck_require__(358);
5488
+ const update_kc_gen_1 = __nccwpck_require__(810);
5461
5489
  function keycloakify(params) {
5462
5490
  const { postBuild, ...buildOptions } = params;
5463
5491
  let projectDirPath = undefined;
@@ -5522,7 +5550,7 @@ function keycloakify(params) {
5522
5550
  const buildContext = (0, buildContext_1.getBuildContext)({
5523
5551
  projectDirPath
5524
5552
  });
5525
- (0, copyKeycloakResourcesToPublic_1.copyKeycloakResourcesToPublic)({ buildContext });
5553
+ await (0, copy_keycloak_resources_to_public_1.command)({ buildContext });
5526
5554
  await (0, update_kc_gen_1.command)({ buildContext });
5527
5555
  },
5528
5556
  transform: (code, id) => {
@@ -1,6 +0,0 @@
1
- export type BuildContextLike = {
2
- publicDirPath: string;
3
- };
4
- export declare function copyKeycloakResourcesToPublic(params: {
5
- buildContext: BuildContextLike;
6
- }): void;
@@ -1,95 +0,0 @@
1
- import { join as pathJoin, dirname as pathDirname } from "path";
2
- import { WELL_KNOWN_DIRECTORY_BASE_NAME } from "../shared/constants";
3
- import { readThisNpmPackageVersion } from "../tools/readThisNpmPackageVersion";
4
- import { assert } from "tsafe/assert";
5
- import * as fs from "fs";
6
- import { rmSync } from "../tools/fs.rmSync";
7
- import type { BuildContext } from "./buildContext";
8
- import { transformCodebase } from "../tools/transformCodebase";
9
- import { getThisCodebaseRootDirPath } from "../tools/getThisCodebaseRootDirPath";
10
-
11
- export type BuildContextLike = {
12
- publicDirPath: string;
13
- };
14
-
15
- assert<BuildContext extends BuildContextLike ? true : false>();
16
-
17
- export function copyKeycloakResourcesToPublic(params: {
18
- buildContext: BuildContextLike;
19
- }) {
20
- const { buildContext } = params;
21
-
22
- const destDirPath = pathJoin(
23
- buildContext.publicDirPath,
24
- WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
25
- );
26
-
27
- const keycloakifyBuildinfoFilePath = pathJoin(destDirPath, "keycloakify.buildinfo");
28
-
29
- const keycloakifyBuildinfoRaw = JSON.stringify(
30
- {
31
- keycloakifyVersion: readThisNpmPackageVersion()
32
- },
33
- null,
34
- 2
35
- );
36
-
37
- skip_if_already_done: {
38
- if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
39
- break skip_if_already_done;
40
- }
41
-
42
- const keycloakifyBuildinfoRaw_previousRun = fs
43
- .readFileSync(keycloakifyBuildinfoFilePath)
44
- .toString("utf8");
45
-
46
- if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
47
- break skip_if_already_done;
48
- }
49
-
50
- return;
51
- }
52
-
53
- rmSync(destDirPath, { force: true, recursive: true });
54
-
55
- // NOTE: To remove in a while, remove the legacy keycloak-resources directory
56
- rmSync(pathJoin(pathDirname(destDirPath), "keycloak-resources"), {
57
- force: true,
58
- recursive: true
59
- });
60
- rmSync(pathJoin(pathDirname(destDirPath), ".keycloakify"), {
61
- force: true,
62
- recursive: true
63
- });
64
-
65
- fs.mkdirSync(destDirPath, { recursive: true });
66
-
67
- fs.writeFileSync(pathJoin(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
68
-
69
- transformCodebase({
70
- srcDirPath: pathJoin(
71
- getThisCodebaseRootDirPath(),
72
- "res",
73
- "public",
74
- WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
75
- ),
76
- destDirPath
77
- });
78
-
79
- fs.writeFileSync(
80
- pathJoin(destDirPath, "README.txt"),
81
- Buffer.from(
82
- // prettier-ignore
83
- [
84
- "This directory is only used in dev mode by Keycloakify",
85
- "It won't be included in your final build.",
86
- "Do not modify anything in this directory.",
87
- ].join("\n")
88
- )
89
- );
90
-
91
- fs.writeFileSync(
92
- keycloakifyBuildinfoFilePath,
93
- Buffer.from(keycloakifyBuildinfoRaw, "utf8")
94
- );
95
- }