keycloakify 10.0.0-rc.117 → 10.0.0-rc.119

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 (51) hide show
  1. package/bin/{490.index.js → 246.index.js} +20 -2
  2. package/bin/31.index.js +151 -159
  3. package/bin/440.index.js +27 -22
  4. package/bin/526.index.js +168 -56
  5. package/bin/599.index.js +560 -0
  6. package/bin/622.index.js +4 -2
  7. package/bin/{36.index.js → 678.index.js} +577 -71
  8. package/bin/{180.index.js → 697.index.js} +611 -526
  9. package/bin/743.index.js +70 -0
  10. package/bin/780.index.js +729 -0
  11. package/bin/932.index.js +725 -48
  12. package/bin/{966.index.js → 941.index.js} +2 -19
  13. package/bin/main.js +19 -7
  14. package/bin/shared/buildContext.d.ts +28 -19
  15. package/bin/shared/buildContext.js.map +1 -1
  16. package/bin/shared/getLatestsSemVersionedTag.d.ts +10 -0
  17. package/bin/shared/getLatestsSemVersionedTag.js.map +1 -0
  18. package/bin/shared/promptKeycloakVersion.js.map +1 -1
  19. package/login/UserProfileFormFields.js +2 -1
  20. package/login/UserProfileFormFields.js.map +1 -1
  21. package/package.json +24 -5
  22. package/src/bin/initialize-account-theme/copyBoilerplate.ts +32 -0
  23. package/src/bin/initialize-account-theme/index.ts +1 -0
  24. package/src/bin/initialize-account-theme/initialize-account-theme.ts +95 -0
  25. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +21 -0
  26. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +150 -0
  27. package/src/bin/initialize-account-theme/src/multi-page/KcContext.ts +12 -0
  28. package/src/bin/initialize-account-theme/src/multi-page/KcPage.tsx +25 -0
  29. package/src/bin/initialize-account-theme/src/multi-page/KcPageStory.tsx +38 -0
  30. package/src/bin/initialize-account-theme/src/multi-page/i18n.ts +5 -0
  31. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +7 -0
  32. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +11 -0
  33. package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +92 -0
  34. package/src/bin/keycloakify/buildJars/buildJar.ts +2 -2
  35. package/src/bin/keycloakify/buildJars/buildJars.ts +3 -4
  36. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +26 -20
  37. package/src/bin/keycloakify/keycloakify.ts +1 -1
  38. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +2 -2
  39. package/src/bin/main.ts +14 -0
  40. package/src/bin/shared/buildContext.ts +246 -225
  41. package/src/bin/shared/getLatestsSemVersionedTag.ts +180 -0
  42. package/src/bin/shared/promptKeycloakVersion.ts +8 -77
  43. package/src/bin/start-keycloak/appBuild.ts +13 -9
  44. package/src/bin/tools/downloadAndExtractArchive.ts +4 -2
  45. package/src/bin/tools/npmInstall.ts +63 -0
  46. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +3 -2
  47. package/src/bin/tsconfig.json +3 -1
  48. package/src/login/UserProfileFormFields.tsx +5 -1
  49. package/src/vite-plugin/vite-plugin.ts +7 -5
  50. package/vite-plugin/index.js +156 -180
  51. package/vite-plugin/vite-plugin.d.ts +6 -4
package/bin/526.index.js CHANGED
@@ -3,13 +3,13 @@ exports.id = 526;
3
3
  exports.ids = [526];
4
4
  exports.modules = {
5
5
 
6
- /***/ 95781:
6
+ /***/ 97189:
7
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
8
 
9
9
 
10
10
  // EXPORTS
11
11
  __webpack_require__.d(__webpack_exports__, {
12
- "s": () => (/* binding */ promptKeycloakVersion)
12
+ "_": () => (/* binding */ getLatestsSemVersionedTag)
13
13
  });
14
14
 
15
15
  ;// CONCATENATED MODULE: ./dist/bin/tools/octokit-addons/listTags.js
@@ -79,7 +79,7 @@ function getLatestsSemVersionedTagFactory(params) {
79
79
  const { octokit } = params;
80
80
  async function getLatestsSemVersionedTag(params) {
81
81
  var _a, e_1, _b, _c;
82
- const { owner, repo, count } = params;
82
+ const { owner, repo, count, doIgnoreReleaseCandidates } = params;
83
83
  const semVersionedTags = [];
84
84
  const { listTags } = listTagsFactory({ octokit });
85
85
  try {
@@ -95,7 +95,7 @@ function getLatestsSemVersionedTagFactory(params) {
95
95
  catch (_g) {
96
96
  continue;
97
97
  }
98
- if (version.rc !== undefined) {
98
+ if (doIgnoreReleaseCandidates && version.rc !== undefined) {
99
99
  continue;
100
100
  }
101
101
  semVersionedTags.push({ tag, version });
@@ -121,16 +121,30 @@ function getLatestsSemVersionedTagFactory(params) {
121
121
  //# sourceMappingURL=getLatestsSemVersionedTag.js.map
122
122
  // EXTERNAL MODULE: ./node_modules/@octokit/rest/dist-node/index.js
123
123
  var dist_node = __webpack_require__(55375);
124
- // EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
125
- var dist = __webpack_require__(99398);
126
- var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
127
124
  // EXTERNAL MODULE: external "path"
128
125
  var external_path_ = __webpack_require__(71017);
129
126
  // EXTERNAL MODULE: external "fs"
130
127
  var external_fs_ = __webpack_require__(57147);
128
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
129
+ var lib = __webpack_require__(52300);
130
+ // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
131
+ var assert = __webpack_require__(88078);
131
132
  // EXTERNAL MODULE: ./node_modules/tsafe/id.js
132
133
  var id = __webpack_require__(43047);
133
- ;// CONCATENATED MODULE: ./dist/bin/shared/promptKeycloakVersion.js
134
+ // EXTERNAL MODULE: ./node_modules/evt/tools/inDepth/same.js
135
+ var same = __webpack_require__(33805);
136
+ ;// CONCATENATED MODULE: ./dist/bin/shared/getLatestsSemVersionedTag.js
137
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
138
+ var t = {};
139
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
140
+ t[p] = s[p];
141
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
142
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
143
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
144
+ t[p[i]] = s[p[i]];
145
+ }
146
+ return t;
147
+ };
134
148
 
135
149
 
136
150
 
@@ -138,50 +152,144 @@ var id = __webpack_require__(43047);
138
152
 
139
153
 
140
154
 
141
- async function promptKeycloakVersion(params) {
142
- const { startingFromMajor, excludeMajorVersions, cacheDirPath } = params;
143
- const { getLatestsSemVersionedTag } = (() => {
144
- const { octokit } = (() => {
155
+
156
+ let getLatestsSemVersionedTag_stateless = undefined;
157
+ const CACHE_VERSION = 1;
158
+ async function getLatestsSemVersionedTag(_a) {
159
+ var { cacheDirPath } = _a, params = __rest(_a, ["cacheDirPath"]);
160
+ const cacheFilePath = (0,external_path_.join)(cacheDirPath, "latest-sem-versioned-tags.json");
161
+ const cacheLookupResult = (() => {
162
+ const getResult_currentCache = (currentCacheEntries) => ({
163
+ hasCachedResult: false,
164
+ currentCache: {
165
+ version: CACHE_VERSION,
166
+ entries: currentCacheEntries
167
+ }
168
+ });
169
+ if (!external_fs_.existsSync(cacheFilePath)) {
170
+ return getResult_currentCache([]);
171
+ }
172
+ let cache_json;
173
+ try {
174
+ cache_json = external_fs_.readFileSync(cacheFilePath).toString("utf8");
175
+ }
176
+ catch (_a) {
177
+ return getResult_currentCache([]);
178
+ }
179
+ let cache_json_parsed;
180
+ try {
181
+ cache_json_parsed = JSON.parse(cache_json);
182
+ }
183
+ catch (_b) {
184
+ return getResult_currentCache([]);
185
+ }
186
+ const zSemVer = (() => {
187
+ const zTargetType = lib.z.object({
188
+ major: lib.z.number(),
189
+ minor: lib.z.number(),
190
+ patch: lib.z.number(),
191
+ rc: lib.z.number().optional(),
192
+ parsedFrom: lib.z.string()
193
+ });
194
+ (0,assert.assert)();
195
+ return (0,id.id)(zTargetType);
196
+ })();
197
+ const zCache = (() => {
198
+ const zTargetType = lib.z.object({
199
+ version: lib.z.literal(CACHE_VERSION),
200
+ entries: lib.z.array(lib.z.object({
201
+ time: lib.z.number(),
202
+ params: lib.z.object({
203
+ owner: lib.z.string(),
204
+ repo: lib.z.string(),
205
+ count: lib.z.number(),
206
+ doIgnoreReleaseCandidates: lib.z.boolean()
207
+ }),
208
+ result: lib.z.array(lib.z.object({
209
+ tag: lib.z.string(),
210
+ version: zSemVer
211
+ }))
212
+ }))
213
+ });
214
+ (0,assert.assert)();
215
+ return (0,id.id)(zTargetType);
216
+ })();
217
+ let cache;
218
+ try {
219
+ cache = zCache.parse(cache_json_parsed);
220
+ }
221
+ catch (_c) {
222
+ return getResult_currentCache([]);
223
+ }
224
+ const cacheEntry = cache.entries.find(e => (0,same.same)(e.params, params));
225
+ if (cacheEntry === undefined) {
226
+ return getResult_currentCache(cache.entries);
227
+ }
228
+ if (Date.now() - cacheEntry.time > 3600000) {
229
+ return getResult_currentCache(cache.entries.filter(e => e !== cacheEntry));
230
+ }
231
+ return {
232
+ hasCachedResult: true,
233
+ cachedResult: cacheEntry.result
234
+ };
235
+ })();
236
+ if (cacheLookupResult.hasCachedResult) {
237
+ return cacheLookupResult.cachedResult;
238
+ }
239
+ const { currentCache } = cacheLookupResult;
240
+ getLatestsSemVersionedTag_stateless !== null && getLatestsSemVersionedTag_stateless !== void 0 ? getLatestsSemVersionedTag_stateless : (getLatestsSemVersionedTag_stateless = (() => {
241
+ const octokit = (() => {
145
242
  const githubToken = process.env.GITHUB_TOKEN;
146
243
  const octokit = new dist_node.Octokit(githubToken === undefined ? undefined : { auth: githubToken });
147
- return { octokit };
244
+ return octokit;
148
245
  })();
149
246
  const { getLatestsSemVersionedTag } = getLatestsSemVersionedTagFactory({
150
247
  octokit
151
248
  });
152
- return { getLatestsSemVersionedTag };
153
- })();
154
- const semVersionedTagByMajor = new Map();
155
- const semVersionedTags = await (async () => {
156
- const cacheFilePath = (0,external_path_.join)(cacheDirPath, "keycloak-versions.json");
157
- use_cache: {
158
- if (!external_fs_.existsSync(cacheFilePath)) {
159
- break use_cache;
160
- }
161
- const cache = JSON.parse(external_fs_.readFileSync(cacheFilePath).toString("utf8"));
162
- if (Date.now() - cache.time > 3600000) {
163
- external_fs_.unlinkSync(cacheFilePath);
164
- break use_cache;
165
- }
166
- return cache.semVersionedTags;
167
- }
168
- const semVersionedTags = await getLatestsSemVersionedTag({
169
- count: 50,
170
- owner: "keycloak",
171
- repo: "keycloak"
172
- });
173
- {
174
- const dirPath = (0,external_path_.dirname)(cacheFilePath);
175
- if (!external_fs_.existsSync(dirPath)) {
176
- external_fs_.mkdirSync(dirPath, { recursive: true });
177
- }
249
+ return getLatestsSemVersionedTag;
250
+ })());
251
+ const result = await getLatestsSemVersionedTag_stateless(params);
252
+ currentCache.entries.push({
253
+ time: Date.now(),
254
+ params,
255
+ result
256
+ });
257
+ {
258
+ const dirPath = (0,external_path_.dirname)(cacheFilePath);
259
+ if (!external_fs_.existsSync(dirPath)) {
260
+ external_fs_.mkdirSync(dirPath, { recursive: true });
178
261
  }
179
- external_fs_.writeFileSync(cacheFilePath, JSON.stringify((0,id.id)({
180
- time: Date.now(),
181
- semVersionedTags
182
- }), null, 2));
183
- return semVersionedTags;
184
- })();
262
+ }
263
+ external_fs_.writeFileSync(cacheFilePath, JSON.stringify(currentCache, null, 2));
264
+ return result;
265
+ }
266
+ //# sourceMappingURL=getLatestsSemVersionedTag.js.map
267
+
268
+ /***/ }),
269
+
270
+ /***/ 82635:
271
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
272
+
273
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
274
+ /* harmony export */ "s": () => (/* binding */ promptKeycloakVersion)
275
+ /* harmony export */ });
276
+ /* harmony import */ var _getLatestsSemVersionedTag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97189);
277
+ /* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99398);
278
+ /* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cli_select__WEBPACK_IMPORTED_MODULE_1__);
279
+ /* harmony import */ var _tools_SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
280
+
281
+
282
+
283
+ async function promptKeycloakVersion(params) {
284
+ const { startingFromMajor, excludeMajorVersions, cacheDirPath } = params;
285
+ const semVersionedTagByMajor = new Map();
286
+ const semVersionedTags = await (0,_getLatestsSemVersionedTag__WEBPACK_IMPORTED_MODULE_0__/* .getLatestsSemVersionedTag */ ._)({
287
+ cacheDirPath,
288
+ count: 50,
289
+ owner: "keycloak",
290
+ repo: "keycloak",
291
+ doIgnoreReleaseCandidates: true
292
+ });
185
293
  semVersionedTags.forEach(semVersionedTag => {
186
294
  if (startingFromMajor !== undefined &&
187
295
  semVersionedTag.version.major < startingFromMajor) {
@@ -192,13 +300,13 @@ async function promptKeycloakVersion(params) {
192
300
  }
193
301
  const currentSemVersionedTag = semVersionedTagByMajor.get(semVersionedTag.version.major);
194
302
  if (currentSemVersionedTag !== undefined &&
195
- SemVer/* SemVer.compare */.h.compare(semVersionedTag.version, currentSemVersionedTag.version) === -1) {
303
+ _tools_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.compare */ .h.compare(semVersionedTag.version, currentSemVersionedTag.version) === -1) {
196
304
  return;
197
305
  }
198
306
  semVersionedTagByMajor.set(semVersionedTag.version.major, semVersionedTag);
199
307
  });
200
308
  const lastMajorVersions = Array.from(semVersionedTagByMajor.values()).map(({ tag }) => tag);
201
- const { value } = await dist_default()({
309
+ const { value } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
202
310
  values: lastMajorVersions
203
311
  }).catch(() => {
204
312
  process.exit(-1);
@@ -225,8 +333,8 @@ __webpack_require__.d(__webpack_exports__, {
225
333
  var shared_buildContext = __webpack_require__(56031);
226
334
  // EXTERNAL MODULE: ./node_modules/tsafe/exclude.js
227
335
  var exclude = __webpack_require__(41370);
228
- // EXTERNAL MODULE: ./dist/bin/shared/promptKeycloakVersion.js + 2 modules
229
- var promptKeycloakVersion = __webpack_require__(95781);
336
+ // EXTERNAL MODULE: ./dist/bin/shared/promptKeycloakVersion.js
337
+ var promptKeycloakVersion = __webpack_require__(82635);
230
338
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
231
339
  var constants = __webpack_require__(173);
232
340
  // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
@@ -266,10 +374,12 @@ var Deferred = __webpack_require__(50689);
266
374
 
267
375
 
268
376
 
377
+
378
+
269
379
  (0,assert.assert)();
270
380
  async function appBuild(params) {
271
381
  const { buildContext } = params;
272
- switch (buildContext.bundler.type) {
382
+ switch (buildContext.bundler) {
273
383
  case "vite":
274
384
  return appBuild_vite({ buildContext });
275
385
  case "webpack":
@@ -278,7 +388,7 @@ async function appBuild(params) {
278
388
  }
279
389
  async function appBuild_vite(params) {
280
390
  const { buildContext } = params;
281
- (0,assert.assert)(buildContext.bundler.type === "vite");
391
+ (0,assert.assert)(buildContext.bundler === "vite");
282
392
  const dIsSuccess = new Deferred.Deferred();
283
393
  console.log(source_default().blue("Running: 'npx vite build'"));
284
394
  const child = external_child_process_.spawn("npx", ["vite", "build"], {
@@ -297,12 +407,14 @@ async function appBuild_vite(params) {
297
407
  return { isAppBuildSuccess: isSuccess };
298
408
  }
299
409
  async function appBuild_webpack(params) {
410
+ var _a;
300
411
  const { buildContext } = params;
301
- (0,assert.assert)(buildContext.bundler.type === "webpack");
302
- const entries = Object.entries(buildContext.bundler.packageJsonScripts).filter(([, scriptCommand]) => scriptCommand.includes("keycloakify build"));
412
+ (0,assert.assert)(buildContext.bundler === "webpack");
413
+ const entries = Object.entries(((_a = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString("utf8"))
414
+ .scripts) !== null && _a !== void 0 ? _a : {})).filter(([, scriptCommand]) => scriptCommand.includes("keycloakify build"));
303
415
  if (entries.length === 0) {
304
416
  console.log(source_default().red([
305
- `You should have a script in your package.json at ${buildContext.bundler.packageJsonDirPath}`,
417
+ `You should have a script in your package.json at ${(0,external_path_.relative)(process.cwd(), (0,external_path_.dirname)(buildContext.packageJsonFilePath))}`,
306
418
  `that includes the 'keycloakify build' command`
307
419
  ].join(" ")));
308
420
  process.exit(-1);
@@ -329,7 +441,7 @@ async function appBuild_webpack(params) {
329
441
  console.log(source_default().red(`Your ${scriptName} script should look like "... && keycloakify build ..."`));
330
442
  process.exit(-1);
331
443
  }
332
- let commandCwd = buildContext.bundler.packageJsonDirPath;
444
+ let commandCwd = (0,external_path_.dirname)(buildContext.packageJsonFilePath);
333
445
  for (const subCommand of appBuildSubCommands) {
334
446
  const dIsSuccess = new Deferred.Deferred();
335
447
  const [command, ...args] = subCommand.split(" ");
@@ -348,7 +460,7 @@ async function appBuild_webpack(params) {
348
460
  var _a;
349
461
  const separator = external_path_.sep === "/" ? ":" : ";";
350
462
  return [
351
- (0,external_path_.join)(buildContext.bundler.packageJsonDirPath, "node_modules", ".bin"),
463
+ (0,external_path_.join)((0,external_path_.dirname)(buildContext.packageJsonFilePath), "node_modules", ".bin"),
352
464
  ...((_a = process.env.PATH) !== null && _a !== void 0 ? _a : "").split(separator)
353
465
  ].join(separator);
354
466
  })() }),