keycloakify 11.4.0-rc.0 → 11.4.1
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 +2 -0
- package/account/i18n/noJsx/getI18n.js +5 -7
- package/account/i18n/noJsx/getI18n.js.map +1 -1
- package/account/i18n/withJsx/useI18n.js +15 -4
- package/account/i18n/withJsx/useI18n.js.map +1 -1
- package/bin/20.index.js +0 -85
- package/bin/33.index.js +55 -212
- package/bin/356.index.js +106 -45
- package/bin/36.index.js +1 -2922
- package/bin/{526.index.js → 392.index.js} +107 -3
- package/bin/40.index.js +1 -86
- package/bin/453.index.js +85 -22
- package/bin/573.index.js +5 -86
- package/bin/653.index.js +752 -0
- package/bin/658.index.js +197 -0
- package/bin/735.index.js +343 -116
- package/bin/786.index.js +78 -14
- package/bin/805.index.js +15 -18
- package/bin/921.index.js +79 -18
- package/bin/97.index.js +64 -13
- package/bin/main.js +165 -86
- package/bin/shared/constants.d.ts +2 -0
- package/bin/shared/constants.js +3 -1
- package/bin/shared/constants.js.map +1 -1
- package/bin/start-keycloak/startViteDevServer.d.ts +8 -0
- package/bin/tools/crawlAsync.d.ts +1 -1
- package/bin/tools/isTrackedByGit.d.ts +3 -0
- package/bin/tools/runPrettier.d.ts +5 -5
- package/bin/tools/untrackFromGit.d.ts +3 -0
- package/lib/getKcClsx.js +1 -2
- package/lib/getKcClsx.js.map +1 -1
- package/login/KcContext/KcContext.d.ts +2 -2
- package/login/KcContext/kcContextMocks.d.ts +1 -1
- package/login/TemplateProps.d.ts +0 -1
- package/login/i18n/noJsx/getI18n.js +5 -7
- package/login/i18n/noJsx/getI18n.js.map +1 -1
- package/login/i18n/withJsx/useI18n.js +15 -4
- package/login/i18n/withJsx/useI18n.js.map +1 -1
- package/login/pages/LoginConfigTotp.js +1 -1
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/login/pages/LoginPasskeysConditionalAuthenticate.js +16 -18
- package/login/pages/LoginPasskeysConditionalAuthenticate.js.map +1 -1
- package/package.json +17 -7
- package/src/account/i18n/noJsx/getI18n.tsx +5 -7
- package/src/account/i18n/withJsx/useI18n.tsx +18 -4
- package/src/bin/eject-page.ts +28 -10
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +3 -18
- package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +1 -2
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +6 -1
- package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +39 -0
- package/src/bin/keycloakify/generateResources/generateResources.ts +6 -2
- package/src/bin/main.ts +51 -4
- package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +30 -19
- package/src/bin/postinstall/installUiModulesPeerDependencies.ts +3 -3
- package/src/bin/postinstall/managedGitignoreFile.ts +4 -3
- package/src/bin/postinstall/postinstall.ts +24 -2
- package/src/bin/postinstall/uiModuleMeta.ts +14 -9
- package/src/bin/shared/buildContext.ts +1 -2
- package/src/bin/shared/constants.ts +4 -1
- package/src/bin/start-keycloak/myrealm-realm-25.json +21 -34
- package/src/bin/start-keycloak/myrealm-realm-26.json +32 -35
- package/src/bin/start-keycloak/start-keycloak.ts +94 -1
- package/src/bin/start-keycloak/startViteDevServer.ts +66 -0
- package/src/bin/tools/crawlAsync.ts +6 -6
- package/src/bin/tools/isTrackedByGit.ts +29 -0
- package/src/bin/tools/listInstalledModules.ts +1 -2
- package/src/bin/tools/npmInstall.ts +396 -1
- package/src/bin/tools/runPrettier.ts +63 -14
- package/src/bin/tools/untrackFromGit.ts +24 -0
- package/src/bin/tsconfig.json +1 -1
- package/src/bin/update-kc-gen.ts +17 -2
- package/src/lib/getKcClsx.ts +1 -2
- package/src/login/KcContext/KcContext.ts +2 -2
- package/src/login/KcContext/kcContextMocks.ts +1 -1
- package/src/login/TemplateProps.ts +0 -1
- package/src/login/i18n/noJsx/getI18n.tsx +5 -7
- package/src/login/i18n/withJsx/useI18n.tsx +18 -4
- package/src/login/pages/LoginConfigTotp.tsx +18 -20
- package/src/login/pages/LoginPasskeysConditionalAuthenticate.tsx +51 -52
- package/src/tools/StatefulObservable/StatefulObservable.ts +1 -2
- package/src/tools/deepAssign.ts +1 -2
- package/src/tools/extractLastParenthesisContent.ts +43 -0
- package/src/vite-plugin/vite-plugin.ts +67 -0
- package/stories/login/pages/Info.stories.tsx +3 -39
- package/tools/StatefulObservable/StatefulObservable.js +1 -2
- package/tools/StatefulObservable/StatefulObservable.js.map +1 -1
- package/tools/deepAssign.js +1 -2
- package/tools/deepAssign.js.map +1 -1
- package/tools/extractLastParenthesisContent.d.ts +6 -0
- package/tools/extractLastParenthesisContent.js +36 -0
- package/tools/extractLastParenthesisContent.js.map +1 -0
- package/vite-plugin/index.js +326 -186
- package/bin/124.index.js +0 -348
- package/stories/login/pages/LoginDeviceVerifyUserCode.stories.tsx +0 -18
package/bin/786.index.js
CHANGED
@@ -142,8 +142,8 @@ function getNodeModulesBinDirPath() {
|
|
142
142
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
143
143
|
|
144
144
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
145
|
+
/* harmony export */ "LG": () => (/* binding */ getPrettier),
|
145
146
|
/* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
|
146
|
-
/* harmony export */ "cI": () => (/* binding */ getPrettierAndConfig),
|
147
147
|
/* harmony export */ "eY": () => (/* binding */ runPrettier)
|
148
148
|
/* harmony export */ });
|
149
149
|
/* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
|
@@ -151,17 +151,24 @@ function getNodeModulesBinDirPath() {
|
|
151
151
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
152
152
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
|
153
153
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
|
154
|
-
/* harmony import */ var
|
154
|
+
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
|
155
155
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
|
156
156
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
|
157
157
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
|
158
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
|
159
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
|
160
|
+
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
|
161
|
+
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
|
158
162
|
|
159
163
|
|
160
164
|
|
161
165
|
|
162
166
|
|
163
167
|
|
164
|
-
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
165
172
|
async function getIsPrettierAvailable() {
|
166
173
|
var _a;
|
167
174
|
if (getIsPrettierAvailable.cache !== undefined) {
|
@@ -174,26 +181,53 @@ async function getIsPrettierAvailable() {
|
|
174
181
|
getIsPrettierAvailable.cache = isPrettierAvailable;
|
175
182
|
return isPrettierAvailable;
|
176
183
|
}
|
177
|
-
|
178
|
-
async function
|
184
|
+
getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
185
|
+
async function getPrettier() {
|
179
186
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
|
180
|
-
if (
|
181
|
-
return
|
187
|
+
if (getPrettier.cache !== undefined) {
|
188
|
+
return getPrettier.cache;
|
182
189
|
}
|
183
|
-
|
190
|
+
let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
191
|
+
import_prettier: {
|
192
|
+
// NOTE: When module is linked we want to make sure we import the correct version
|
193
|
+
// of prettier, that is the one of the project, not the one of this repo.
|
194
|
+
// So we do a sketchy eval to bypass ncc.
|
195
|
+
// We make sure to only do that when linking, otherwise we import properly.
|
196
|
+
if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
|
197
|
+
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
|
198
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
|
199
|
+
break import_prettier;
|
200
|
+
}
|
201
|
+
prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
|
202
|
+
}
|
203
|
+
const configHash = await (async () => {
|
204
|
+
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
|
205
|
+
if (configFilePath === null) {
|
206
|
+
return "";
|
207
|
+
}
|
208
|
+
const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
|
209
|
+
return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
|
210
|
+
})();
|
184
211
|
const prettierAndConfig = {
|
185
212
|
prettier,
|
186
|
-
|
213
|
+
configHash
|
187
214
|
};
|
188
|
-
|
215
|
+
getPrettier.cache = prettierAndConfig;
|
189
216
|
return prettierAndConfig;
|
190
217
|
}
|
191
218
|
async function runPrettier(params) {
|
192
219
|
const { sourceCode, filePath } = params;
|
193
220
|
let formattedSourceCode;
|
194
221
|
try {
|
195
|
-
const { prettier
|
196
|
-
|
222
|
+
const { prettier } = await getPrettier();
|
223
|
+
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
224
|
+
resolveConfig: true
|
225
|
+
});
|
226
|
+
if (ignored) {
|
227
|
+
return sourceCode;
|
228
|
+
}
|
229
|
+
const config = await prettier.resolveConfig(filePath);
|
230
|
+
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
|
197
231
|
}
|
198
232
|
catch (error) {
|
199
233
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
|
@@ -229,6 +263,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
229
263
|
|
230
264
|
async function command(params) {
|
231
265
|
const { buildContext } = params;
|
266
|
+
run_copy_assets_to_public: {
|
267
|
+
if (buildContext.bundler !== "webpack") {
|
268
|
+
break run_copy_assets_to_public;
|
269
|
+
}
|
270
|
+
const { command } = await __webpack_require__.e(/* import() */ 658).then(__webpack_require__.bind(__webpack_require__, 18040));
|
271
|
+
await command({ buildContext });
|
272
|
+
}
|
232
273
|
const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
|
233
274
|
commandName: "update-kc-gen",
|
234
275
|
buildContext
|
@@ -236,7 +277,7 @@ async function command(params) {
|
|
236
277
|
if (hasBeenHandled) {
|
237
278
|
return;
|
238
279
|
}
|
239
|
-
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc
|
280
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
|
240
281
|
const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
|
241
282
|
const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
|
242
283
|
const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
|
@@ -260,7 +301,12 @@ async function command(params) {
|
|
260
301
|
``,
|
261
302
|
`export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
|
262
303
|
``,
|
263
|
-
|
304
|
+
`/**`,
|
305
|
+
` * NOTE: Do not import this type except maybe in your entrypoint. `,
|
306
|
+
` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
|
307
|
+
` * Depending on the theme type you are working on.`,
|
308
|
+
` */`,
|
309
|
+
`export type KcContext =`,
|
264
310
|
hasLoginTheme && ` | import("./login/KcContext").KcContext`,
|
265
311
|
hasAccountTheme && ` | import("./account/KcContext").KcContext`,
|
266
312
|
hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
|
@@ -342,6 +388,24 @@ async function command(params) {
|
|
342
388
|
}
|
343
389
|
//# sourceMappingURL=update-kc-gen.js.map
|
344
390
|
|
391
|
+
/***/ }),
|
392
|
+
|
393
|
+
/***/ 76030:
|
394
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
395
|
+
|
396
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
397
|
+
/* harmony export */ "r": () => (/* binding */ symToStr)
|
398
|
+
/* harmony export */ });
|
399
|
+
/** @see <https://docs.tsafe.dev/main/symtostr> */
|
400
|
+
function symToStr(wrap) {
|
401
|
+
// @ts-expect-error: We know better
|
402
|
+
return Object.keys(wrap)[0];
|
403
|
+
}
|
404
|
+
|
405
|
+
|
406
|
+
//# sourceMappingURL=symToStr.mjs.map
|
407
|
+
|
408
|
+
|
345
409
|
/***/ })
|
346
410
|
|
347
411
|
};
|
package/bin/805.index.js
CHANGED
@@ -3,23 +3,6 @@ exports.id = 805;
|
|
3
3
|
exports.ids = [805];
|
4
4
|
exports.modules = {
|
5
5
|
|
6
|
-
/***/ 11800:
|
7
|
-
/***/ ((__unused_webpack_module, exports) => {
|
8
|
-
|
9
|
-
|
10
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
11
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
12
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
13
|
-
exports.typeGuard = void 0;
|
14
|
-
/** https://docs.tsafe.dev/typeguard */
|
15
|
-
function typeGuard(_value, isMatched) {
|
16
|
-
return isMatched;
|
17
|
-
}
|
18
|
-
exports.typeGuard = typeGuard;
|
19
|
-
//# sourceMappingURL=typeGuard.js.map
|
20
|
-
|
21
|
-
/***/ }),
|
22
|
-
|
23
6
|
/***/ 53501:
|
24
7
|
/***/ (function(__unused_webpack_module, exports) {
|
25
8
|
|
@@ -304,7 +287,7 @@ exports.sameFactory = sameFactory;
|
|
304
287
|
|
305
288
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
306
289
|
exports.DateLike = exports.ArrayLike = exports.MapLike = exports.SetLike = void 0;
|
307
|
-
var typeGuard_1 = __webpack_require__(
|
290
|
+
var typeGuard_1 = __webpack_require__(47393);
|
308
291
|
var getPrototypeChain_1 = __webpack_require__(53501);
|
309
292
|
var SetLike;
|
310
293
|
(function (SetLike) {
|
@@ -668,6 +651,20 @@ exports.LightSetImpl = LightSetImpl;
|
|
668
651
|
exports.Polyfill = typeof Set !== "undefined" ? Set : LightSetImpl;
|
669
652
|
//# sourceMappingURL=Set.js.map
|
670
653
|
|
654
|
+
/***/ }),
|
655
|
+
|
656
|
+
/***/ 47393:
|
657
|
+
/***/ ((__unused_webpack_module, exports) => {
|
658
|
+
|
659
|
+
|
660
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
661
|
+
exports.typeGuard = typeGuard;
|
662
|
+
/** https://docs.tsafe.dev/typeguard */
|
663
|
+
function typeGuard(value, isMatched) {
|
664
|
+
return isMatched;
|
665
|
+
}
|
666
|
+
//# sourceMappingURL=typeGuard.js.map
|
667
|
+
|
671
668
|
/***/ })
|
672
669
|
|
673
670
|
};
|
package/bin/921.index.js
CHANGED
@@ -30,8 +30,6 @@ var assert = __webpack_require__(29041);
|
|
30
30
|
var lib = __webpack_require__(52300);
|
31
31
|
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
32
32
|
var id = __webpack_require__(38469);
|
33
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
|
34
|
-
var is = __webpack_require__(16453);
|
35
33
|
;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.js
|
36
34
|
|
37
35
|
|
@@ -39,7 +37,6 @@ var is = __webpack_require__(16453);
|
|
39
37
|
|
40
38
|
|
41
39
|
|
42
|
-
|
43
40
|
(0,assert/* assert */.h)();
|
44
41
|
function updateAccountThemeImplementationInConfig(params) {
|
45
42
|
const { buildContext, accountThemeType } = params;
|
@@ -73,7 +70,7 @@ function updateAccountThemeImplementationInConfig(params) {
|
|
73
70
|
})();
|
74
71
|
const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
|
75
72
|
zParsedPackageJson.parse(parsedPackageJson);
|
76
|
-
(0,assert/* assert */.h)((0,
|
73
|
+
(0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
|
77
74
|
return parsedPackageJson;
|
78
75
|
})();
|
79
76
|
parsedPackageJson.keycloakify.accountThemeImplementation =
|
@@ -325,8 +322,8 @@ function getNodeModulesBinDirPath() {
|
|
325
322
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
326
323
|
|
327
324
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
325
|
+
/* harmony export */ "LG": () => (/* binding */ getPrettier),
|
328
326
|
/* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
|
329
|
-
/* harmony export */ "cI": () => (/* binding */ getPrettierAndConfig),
|
330
327
|
/* harmony export */ "eY": () => (/* binding */ runPrettier)
|
331
328
|
/* harmony export */ });
|
332
329
|
/* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
|
@@ -334,17 +331,24 @@ function getNodeModulesBinDirPath() {
|
|
334
331
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
335
332
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
|
336
333
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
|
337
|
-
/* harmony import */ var
|
334
|
+
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
|
338
335
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
|
339
336
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
|
340
337
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
|
338
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
|
339
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
|
340
|
+
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
|
341
|
+
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
|
342
|
+
|
343
|
+
|
341
344
|
|
342
345
|
|
343
346
|
|
344
347
|
|
345
348
|
|
346
349
|
|
347
|
-
|
350
|
+
|
351
|
+
getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
348
352
|
async function getIsPrettierAvailable() {
|
349
353
|
var _a;
|
350
354
|
if (getIsPrettierAvailable.cache !== undefined) {
|
@@ -357,26 +361,53 @@ async function getIsPrettierAvailable() {
|
|
357
361
|
getIsPrettierAvailable.cache = isPrettierAvailable;
|
358
362
|
return isPrettierAvailable;
|
359
363
|
}
|
360
|
-
|
361
|
-
async function
|
364
|
+
getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
365
|
+
async function getPrettier() {
|
362
366
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
|
363
|
-
if (
|
364
|
-
return
|
367
|
+
if (getPrettier.cache !== undefined) {
|
368
|
+
return getPrettier.cache;
|
369
|
+
}
|
370
|
+
let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
371
|
+
import_prettier: {
|
372
|
+
// NOTE: When module is linked we want to make sure we import the correct version
|
373
|
+
// of prettier, that is the one of the project, not the one of this repo.
|
374
|
+
// So we do a sketchy eval to bypass ncc.
|
375
|
+
// We make sure to only do that when linking, otherwise we import properly.
|
376
|
+
if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
|
377
|
+
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
|
378
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
|
379
|
+
break import_prettier;
|
380
|
+
}
|
381
|
+
prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
|
365
382
|
}
|
366
|
-
const
|
383
|
+
const configHash = await (async () => {
|
384
|
+
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
|
385
|
+
if (configFilePath === null) {
|
386
|
+
return "";
|
387
|
+
}
|
388
|
+
const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
|
389
|
+
return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
|
390
|
+
})();
|
367
391
|
const prettierAndConfig = {
|
368
392
|
prettier,
|
369
|
-
|
393
|
+
configHash
|
370
394
|
};
|
371
|
-
|
395
|
+
getPrettier.cache = prettierAndConfig;
|
372
396
|
return prettierAndConfig;
|
373
397
|
}
|
374
398
|
async function runPrettier(params) {
|
375
399
|
const { sourceCode, filePath } = params;
|
376
400
|
let formattedSourceCode;
|
377
401
|
try {
|
378
|
-
const { prettier
|
379
|
-
|
402
|
+
const { prettier } = await getPrettier();
|
403
|
+
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
404
|
+
resolveConfig: true
|
405
|
+
});
|
406
|
+
if (ignored) {
|
407
|
+
return sourceCode;
|
408
|
+
}
|
409
|
+
const config = await prettier.resolveConfig(filePath);
|
410
|
+
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
|
380
411
|
}
|
381
412
|
catch (error) {
|
382
413
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
|
@@ -412,6 +443,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
412
443
|
|
413
444
|
async function command(params) {
|
414
445
|
const { buildContext } = params;
|
446
|
+
run_copy_assets_to_public: {
|
447
|
+
if (buildContext.bundler !== "webpack") {
|
448
|
+
break run_copy_assets_to_public;
|
449
|
+
}
|
450
|
+
const { command } = await __webpack_require__.e(/* import() */ 658).then(__webpack_require__.bind(__webpack_require__, 18040));
|
451
|
+
await command({ buildContext });
|
452
|
+
}
|
415
453
|
const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
|
416
454
|
commandName: "update-kc-gen",
|
417
455
|
buildContext
|
@@ -419,7 +457,7 @@ async function command(params) {
|
|
419
457
|
if (hasBeenHandled) {
|
420
458
|
return;
|
421
459
|
}
|
422
|
-
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc
|
460
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
|
423
461
|
const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
|
424
462
|
const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
|
425
463
|
const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
|
@@ -443,7 +481,12 @@ async function command(params) {
|
|
443
481
|
``,
|
444
482
|
`export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
|
445
483
|
``,
|
446
|
-
|
484
|
+
`/**`,
|
485
|
+
` * NOTE: Do not import this type except maybe in your entrypoint. `,
|
486
|
+
` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
|
487
|
+
` * Depending on the theme type you are working on.`,
|
488
|
+
` */`,
|
489
|
+
`export type KcContext =`,
|
447
490
|
hasLoginTheme && ` | import("./login/KcContext").KcContext`,
|
448
491
|
hasAccountTheme && ` | import("./account/KcContext").KcContext`,
|
449
492
|
hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
|
@@ -1094,6 +1137,24 @@ const withObjectValues = options => {
|
|
1094
1137
|
|
1095
1138
|
exports.withObjectValues = withObjectValues;
|
1096
1139
|
|
1140
|
+
/***/ }),
|
1141
|
+
|
1142
|
+
/***/ 76030:
|
1143
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
1144
|
+
|
1145
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
1146
|
+
/* harmony export */ "r": () => (/* binding */ symToStr)
|
1147
|
+
/* harmony export */ });
|
1148
|
+
/** @see <https://docs.tsafe.dev/main/symtostr> */
|
1149
|
+
function symToStr(wrap) {
|
1150
|
+
// @ts-expect-error: We know better
|
1151
|
+
return Object.keys(wrap)[0];
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
|
1155
|
+
//# sourceMappingURL=symToStr.mjs.map
|
1156
|
+
|
1157
|
+
|
1097
1158
|
/***/ })
|
1098
1159
|
|
1099
1160
|
};
|
package/bin/97.index.js
CHANGED
@@ -263,8 +263,8 @@ function getNodeModulesBinDirPath() {
|
|
263
263
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
264
264
|
|
265
265
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
266
|
+
/* harmony export */ "LG": () => (/* binding */ getPrettier),
|
266
267
|
/* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
|
267
|
-
/* harmony export */ "cI": () => (/* binding */ getPrettierAndConfig),
|
268
268
|
/* harmony export */ "eY": () => (/* binding */ runPrettier)
|
269
269
|
/* harmony export */ });
|
270
270
|
/* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
|
@@ -272,17 +272,24 @@ function getNodeModulesBinDirPath() {
|
|
272
272
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
273
273
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
|
274
274
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
|
275
|
-
/* harmony import */ var
|
275
|
+
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
|
276
276
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
|
277
277
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
|
278
278
|
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
|
279
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
|
280
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
|
281
|
+
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
|
282
|
+
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
|
279
283
|
|
280
284
|
|
281
285
|
|
282
286
|
|
283
287
|
|
284
288
|
|
285
|
-
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
286
293
|
async function getIsPrettierAvailable() {
|
287
294
|
var _a;
|
288
295
|
if (getIsPrettierAvailable.cache !== undefined) {
|
@@ -295,26 +302,53 @@ async function getIsPrettierAvailable() {
|
|
295
302
|
getIsPrettierAvailable.cache = isPrettierAvailable;
|
296
303
|
return isPrettierAvailable;
|
297
304
|
}
|
298
|
-
|
299
|
-
async function
|
305
|
+
getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
306
|
+
async function getPrettier() {
|
300
307
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
|
301
|
-
if (
|
302
|
-
return
|
308
|
+
if (getPrettier.cache !== undefined) {
|
309
|
+
return getPrettier.cache;
|
310
|
+
}
|
311
|
+
let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
312
|
+
import_prettier: {
|
313
|
+
// NOTE: When module is linked we want to make sure we import the correct version
|
314
|
+
// of prettier, that is the one of the project, not the one of this repo.
|
315
|
+
// So we do a sketchy eval to bypass ncc.
|
316
|
+
// We make sure to only do that when linking, otherwise we import properly.
|
317
|
+
if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
|
318
|
+
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
|
319
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
|
320
|
+
break import_prettier;
|
321
|
+
}
|
322
|
+
prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
|
303
323
|
}
|
304
|
-
const
|
324
|
+
const configHash = await (async () => {
|
325
|
+
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
|
326
|
+
if (configFilePath === null) {
|
327
|
+
return "";
|
328
|
+
}
|
329
|
+
const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
|
330
|
+
return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
|
331
|
+
})();
|
305
332
|
const prettierAndConfig = {
|
306
333
|
prettier,
|
307
|
-
|
334
|
+
configHash
|
308
335
|
};
|
309
|
-
|
336
|
+
getPrettier.cache = prettierAndConfig;
|
310
337
|
return prettierAndConfig;
|
311
338
|
}
|
312
339
|
async function runPrettier(params) {
|
313
340
|
const { sourceCode, filePath } = params;
|
314
341
|
let formattedSourceCode;
|
315
342
|
try {
|
316
|
-
const { prettier
|
317
|
-
|
343
|
+
const { prettier } = await getPrettier();
|
344
|
+
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
345
|
+
resolveConfig: true
|
346
|
+
});
|
347
|
+
if (ignored) {
|
348
|
+
return sourceCode;
|
349
|
+
}
|
350
|
+
const config = await prettier.resolveConfig(filePath);
|
351
|
+
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
|
318
352
|
}
|
319
353
|
catch (error) {
|
320
354
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
|
@@ -903,7 +937,6 @@ exports.withObjectValues = withObjectValues;
|
|
903
937
|
/* harmony export */ });
|
904
938
|
/** @see <https://docs.tsafe.dev/capitalize> */
|
905
939
|
function capitalize(str) {
|
906
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
907
940
|
return (str.charAt(0).toUpperCase() + str.slice(1));
|
908
941
|
}
|
909
942
|
|
@@ -911,6 +944,24 @@ function capitalize(str) {
|
|
911
944
|
//# sourceMappingURL=capitalize.mjs.map
|
912
945
|
|
913
946
|
|
947
|
+
/***/ }),
|
948
|
+
|
949
|
+
/***/ 76030:
|
950
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
951
|
+
|
952
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
953
|
+
/* harmony export */ "r": () => (/* binding */ symToStr)
|
954
|
+
/* harmony export */ });
|
955
|
+
/** @see <https://docs.tsafe.dev/main/symtostr> */
|
956
|
+
function symToStr(wrap) {
|
957
|
+
// @ts-expect-error: We know better
|
958
|
+
return Object.keys(wrap)[0];
|
959
|
+
}
|
960
|
+
|
961
|
+
|
962
|
+
//# sourceMappingURL=symToStr.mjs.map
|
963
|
+
|
964
|
+
|
914
965
|
/***/ })
|
915
966
|
|
916
967
|
};
|