keycloakify 11.7.4 → 11.8.0

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 (29) hide show
  1. package/bin/{911.index.js → 297.index.js} +18918 -11359
  2. package/bin/355.index.js +41 -703
  3. package/bin/363.index.js +3 -0
  4. package/bin/369.index.js +968 -0
  5. package/bin/656.index.js +111 -0
  6. package/bin/{288.index.js → 664.index.js} +13 -119
  7. package/bin/780.index.js +9 -7
  8. package/bin/880.index.js +215 -160
  9. package/bin/932.index.js +965 -0
  10. package/bin/97.index.js +2092 -770
  11. package/bin/main.js +52 -24
  12. package/bin/shared/buildContext.d.ts +11 -3
  13. package/package.json +10 -13
  14. package/src/bin/initialize-account-theme/initialize-account-theme.ts +29 -27
  15. package/src/bin/initialize-email-theme.ts +103 -53
  16. package/src/bin/keycloakify/generateResources/generateResources.ts +285 -205
  17. package/src/bin/shared/{initializeSpa/addSyncExtensionsToPostinstallScript.ts → addSyncExtensionsToPostinstallScript.ts} +1 -1
  18. package/src/bin/shared/buildContext.ts +69 -24
  19. package/src/bin/shared/{initializeSpa/initializeSpa.ts → initializeSpa.ts} +3 -3
  20. package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +6 -0
  21. package/vite-plugin/index.js +48 -20
  22. package/bin/313.index.js +0 -377
  23. package/bin/678.index.js +0 -7565
  24. package/bin/9.index.js +0 -850
  25. package/bin/947.index.js +0 -1565
  26. package/bin/shared/initializeSpa/index.d.ts +0 -1
  27. package/src/bin/shared/initializeSpa/index.ts +0 -1
  28. /package/bin/shared/{initializeSpa/addSyncExtensionsToPostinstallScript.d.ts → addSyncExtensionsToPostinstallScript.d.ts} +0 -0
  29. /package/bin/shared/{initializeSpa/initializeSpa.d.ts → initializeSpa.d.ts} +0 -0
@@ -0,0 +1,965 @@
1
+ "use strict";
2
+ exports.id = 932;
3
+ exports.ids = [932];
4
+ exports.modules = {
5
+
6
+ /***/ 16932:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "command": () => (/* binding */ command)
12
+ /* harmony export */ });
13
+ /* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99398);
14
+ /* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cli_select__WEBPACK_IMPORTED_MODULE_0__);
15
+ /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72138);
16
+ /* harmony import */ var _shared_exitIfUncommittedChanges__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22058);
17
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71017);
18
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
19
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57147);
20
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__);
21
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
22
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(38469);
23
+ /* harmony import */ var _shared_addSyncExtensionsToPostinstallScript__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80339);
24
+ /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(48433);
25
+ /* harmony import */ var _tools_npmInstall__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(50030);
26
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(32081);
27
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_9__);
28
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(52300);
29
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(78818);
30
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_10__);
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ async function command(params) {
45
+ var _a;
46
+ const { buildContext } = params;
47
+ const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_1__/* .maybeDelegateCommandToCustomHandler */ .q)({
48
+ commandName: "initialize-account-theme",
49
+ buildContext
50
+ });
51
+ if (hasBeenHandled) {
52
+ return;
53
+ }
54
+ (0,_shared_exitIfUncommittedChanges__WEBPACK_IMPORTED_MODULE_2__/* .exitIfUncommittedChanges */ .l)({
55
+ projectDirPath: buildContext.projectDirPath
56
+ });
57
+ const emailThemeSrcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(buildContext.themeSrcDirPath, "email");
58
+ if (fs__WEBPACK_IMPORTED_MODULE_4__.existsSync(emailThemeSrcDirPath) &&
59
+ fs__WEBPACK_IMPORTED_MODULE_4__.readdirSync(emailThemeSrcDirPath).length > 0) {
60
+ console.warn(chalk__WEBPACK_IMPORTED_MODULE_10___default().red(`There is already a ${(0,path__WEBPACK_IMPORTED_MODULE_3__.relative)(process.cwd(), emailThemeSrcDirPath)} directory in your project. Aborting.`));
61
+ process.exit(-1);
62
+ }
63
+ const { value: emailThemeType } = await cli_select__WEBPACK_IMPORTED_MODULE_0___default()({
64
+ values: ["native (FreeMarker)", "jsx-email (React)"]
65
+ }).catch(() => {
66
+ process.exit(-1);
67
+ });
68
+ if (emailThemeType === "jsx-email (React)") {
69
+ console.log([
70
+ "There is currently no automated support for keycloakify-email, it has to be done manually, see documentation:",
71
+ "https://docs.keycloakify.dev/theme-types/email-theme"
72
+ ].join("\n"));
73
+ process.exit(0);
74
+ }
75
+ const parsedPackageJson = (() => {
76
+ const zParsedPackageJson = (() => {
77
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_11__.z.object({
78
+ scripts: zod__WEBPACK_IMPORTED_MODULE_11__.z.record(zod__WEBPACK_IMPORTED_MODULE_11__.z.union([zod__WEBPACK_IMPORTED_MODULE_11__.z.string(), zod__WEBPACK_IMPORTED_MODULE_11__.z.undefined()])).optional(),
79
+ dependencies: zod__WEBPACK_IMPORTED_MODULE_11__.z.record(zod__WEBPACK_IMPORTED_MODULE_11__.z.union([zod__WEBPACK_IMPORTED_MODULE_11__.z.string(), zod__WEBPACK_IMPORTED_MODULE_11__.z.undefined()])).optional(),
80
+ devDependencies: zod__WEBPACK_IMPORTED_MODULE_11__.z.record(zod__WEBPACK_IMPORTED_MODULE_11__.z.union([zod__WEBPACK_IMPORTED_MODULE_11__.z.string(), zod__WEBPACK_IMPORTED_MODULE_11__.z.undefined()])).optional()
81
+ });
82
+ tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h;
83
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_12__.id)(zTargetType);
84
+ })();
85
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_4__.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
86
+ zParsedPackageJson.parse(parsedPackageJson);
87
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(parsedPackageJson));
88
+ return parsedPackageJson;
89
+ })();
90
+ (0,_shared_addSyncExtensionsToPostinstallScript__WEBPACK_IMPORTED_MODULE_6__/* .addSyncExtensionsToPostinstallScript */ .N)({
91
+ parsedPackageJson,
92
+ buildContext
93
+ });
94
+ const moduleName = `@keycloakify/email-native`;
95
+ const [version] = JSON.parse(child_process__WEBPACK_IMPORTED_MODULE_9__.execSync(`npm show ${moduleName} versions --json`)
96
+ .toString("utf8")
97
+ .trim())
98
+ .reverse()
99
+ .filter(version => !version.includes("-"));
100
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)(version !== undefined);
101
+ ((_a = parsedPackageJson.dependencies) !== null && _a !== void 0 ? _a : (parsedPackageJson.dependencies = {}))[moduleName] = `~${version}`;
102
+ if (parsedPackageJson.devDependencies !== undefined) {
103
+ delete parsedPackageJson.devDependencies[moduleName];
104
+ }
105
+ {
106
+ let sourceCode = JSON.stringify(parsedPackageJson, undefined, 2);
107
+ if (await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_7__/* .getIsPrettierAvailable */ .MT)()) {
108
+ sourceCode = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_7__/* .runPrettier */ .eY)({
109
+ sourceCode,
110
+ filePath: buildContext.packageJsonFilePath
111
+ });
112
+ }
113
+ fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync(buildContext.packageJsonFilePath, Buffer.from(sourceCode, "utf8"));
114
+ }
115
+ await (0,_tools_npmInstall__WEBPACK_IMPORTED_MODULE_8__/* .npmInstall */ .c)({
116
+ packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_3__.dirname)(buildContext.packageJsonFilePath)
117
+ });
118
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_10___default().green("Email theme initialized."));
119
+ }
120
+ //# sourceMappingURL=initialize-email-theme.js.map
121
+
122
+ /***/ }),
123
+
124
+ /***/ 72138:
125
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
126
+
127
+
128
+ // EXPORTS
129
+ __webpack_require__.d(__webpack_exports__, {
130
+ "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
131
+ });
132
+
133
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
134
+ var esm_assert = __webpack_require__(29041);
135
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
136
+ var constants = __webpack_require__(173);
137
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
138
+
139
+
140
+ const BIN_NAME = "_keycloakify-custom-handler";
141
+ const NOT_IMPLEMENTED_EXIT_CODE = 78;
142
+ function readParams(params) {
143
+ const { apiVersion } = params;
144
+ assert(apiVersion === "v1");
145
+ const commandName = (() => {
146
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
147
+ assert(envValue !== undefined);
148
+ return envValue;
149
+ })();
150
+ const buildContext = (() => {
151
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
152
+ assert(envValue !== undefined);
153
+ return JSON.parse(envValue);
154
+ })();
155
+ return { commandName, buildContext };
156
+ }
157
+ //# sourceMappingURL=customHandler.js.map
158
+ // EXTERNAL MODULE: external "child_process"
159
+ var external_child_process_ = __webpack_require__(32081);
160
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
161
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
162
+ // EXTERNAL MODULE: external "fs"
163
+ var external_fs_ = __webpack_require__(57147);
164
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
165
+
166
+
167
+
168
+
169
+
170
+
171
+ (0,esm_assert/* assert */.h)();
172
+ function maybeDelegateCommandToCustomHandler(params) {
173
+ const { commandName, buildContext } = params;
174
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
175
+ if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
176
+ return { hasBeenHandled: false };
177
+ }
178
+ try {
179
+ external_child_process_.execSync(`npx ${BIN_NAME}`, {
180
+ stdio: "inherit",
181
+ env: Object.assign(Object.assign({}, process.env), { [constants/* CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME */._S.COMMAND_NAME]: commandName, [constants/* CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT */._S.BUILD_CONTEXT]: JSON.stringify(buildContext) })
182
+ });
183
+ }
184
+ catch (error) {
185
+ const status = error.status;
186
+ if (status === NOT_IMPLEMENTED_EXIT_CODE) {
187
+ return { hasBeenHandled: false };
188
+ }
189
+ process.exit(status);
190
+ }
191
+ return { hasBeenHandled: true };
192
+ }
193
+ //# sourceMappingURL=customHandler_delegate.js.map
194
+
195
+ /***/ }),
196
+
197
+ /***/ 22058:
198
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
199
+
200
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
201
+ /* harmony export */ "l": () => (/* binding */ exitIfUncommittedChanges)
202
+ /* harmony export */ });
203
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32081);
204
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);
205
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(78818);
206
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__);
207
+
208
+
209
+ function exitIfUncommittedChanges(params) {
210
+ const { projectDirPath } = params;
211
+ let hasUncommittedChanges = undefined;
212
+ try {
213
+ hasUncommittedChanges =
214
+ child_process__WEBPACK_IMPORTED_MODULE_0___default().execSync(`git status --porcelain`, {
215
+ cwd: projectDirPath
216
+ })
217
+ .toString()
218
+ .trim() !== "";
219
+ }
220
+ catch (_a) {
221
+ // Probably not a git repository
222
+ return;
223
+ }
224
+ if (!hasUncommittedChanges) {
225
+ return;
226
+ }
227
+ console.warn([
228
+ chalk__WEBPACK_IMPORTED_MODULE_1___default().red("Please commit or stash your changes before running this command.\n"),
229
+ "This command will modify your project's files so it's better to have a clean working directory",
230
+ "so that you can easily see what has been changed and revert if needed."
231
+ ].join(" "));
232
+ process.exit(-1);
233
+ }
234
+ //# sourceMappingURL=exitIfUncommittedChanges.js.map
235
+
236
+ /***/ }),
237
+
238
+ /***/ 73776:
239
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
240
+
241
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
242
+ /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
243
+ /* harmony export */ });
244
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
245
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
246
+
247
+ let cache = undefined;
248
+ function getNodeModulesBinDirPath() {
249
+ if (cache !== undefined) {
250
+ return cache;
251
+ }
252
+ const binPath = process.argv[1];
253
+ const segments = [".bin"];
254
+ let foundNodeModules = false;
255
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
256
+ skip_segment: {
257
+ if (foundNodeModules) {
258
+ break skip_segment;
259
+ }
260
+ if (segment === "node_modules") {
261
+ foundNodeModules = true;
262
+ break skip_segment;
263
+ }
264
+ continue;
265
+ }
266
+ segments.unshift(segment);
267
+ }
268
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
269
+ cache = nodeModulesBinDirPath;
270
+ return nodeModulesBinDirPath;
271
+ }
272
+ //# sourceMappingURL=nodeModulesBinDirPath.js.map
273
+
274
+ /***/ }),
275
+
276
+ /***/ 48433:
277
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
278
+
279
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
280
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
281
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
282
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
283
+ /* harmony export */ });
284
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
285
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
286
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
287
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
288
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
289
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
290
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
291
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
292
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
293
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
294
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
295
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
296
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
307
+ async function getIsPrettierAvailable() {
308
+ var _a;
309
+ if (getIsPrettierAvailable.cache !== undefined) {
310
+ return getIsPrettierAvailable.cache;
311
+ }
312
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
313
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
314
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
315
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
316
+ getIsPrettierAvailable.cache = isPrettierAvailable;
317
+ return isPrettierAvailable;
318
+ }
319
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
320
+ async function getPrettier() {
321
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
322
+ if (getPrettier.cache !== undefined) {
323
+ return getPrettier.cache;
324
+ }
325
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
326
+ import_prettier: {
327
+ // NOTE: When module is linked we want to make sure we import the correct version
328
+ // of prettier, that is the one of the project, not the one of this repo.
329
+ // So we do a sketchy eval to bypass ncc.
330
+ // We make sure to only do that when linking, otherwise we import properly.
331
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
332
+ 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"))}")`);
333
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
334
+ break import_prettier;
335
+ }
336
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
337
+ }
338
+ const configHash = await (async () => {
339
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
340
+ if (configFilePath === null) {
341
+ return "";
342
+ }
343
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
344
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
345
+ })();
346
+ const prettierAndConfig = {
347
+ prettier,
348
+ configHash
349
+ };
350
+ getPrettier.cache = prettierAndConfig;
351
+ return prettierAndConfig;
352
+ }
353
+ async function runPrettier(params) {
354
+ const { sourceCode, filePath } = params;
355
+ let formattedSourceCode;
356
+ try {
357
+ const { prettier } = await getPrettier();
358
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
359
+ resolveConfig: true
360
+ });
361
+ if (ignored || inferredParser === null) {
362
+ return sourceCode;
363
+ }
364
+ const config = await prettier.resolveConfig(filePath);
365
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
366
+ }
367
+ catch (error) {
368
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
369
+ throw error;
370
+ }
371
+ return formattedSourceCode;
372
+ }
373
+ //# sourceMappingURL=runPrettier.js.map
374
+
375
+ /***/ }),
376
+
377
+ /***/ 18512:
378
+ /***/ ((module) => {
379
+
380
+
381
+ const x = module.exports;
382
+ const ESC = '\u001B[';
383
+ const OSC = '\u001B]';
384
+ const BEL = '\u0007';
385
+ const SEP = ';';
386
+ const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
387
+
388
+ x.cursorTo = (x, y) => {
389
+ if (typeof x !== 'number') {
390
+ throw new TypeError('The `x` argument is required');
391
+ }
392
+
393
+ if (typeof y !== 'number') {
394
+ return ESC + (x + 1) + 'G';
395
+ }
396
+
397
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
398
+ };
399
+
400
+ x.cursorMove = (x, y) => {
401
+ if (typeof x !== 'number') {
402
+ throw new TypeError('The `x` argument is required');
403
+ }
404
+
405
+ let ret = '';
406
+
407
+ if (x < 0) {
408
+ ret += ESC + (-x) + 'D';
409
+ } else if (x > 0) {
410
+ ret += ESC + x + 'C';
411
+ }
412
+
413
+ if (y < 0) {
414
+ ret += ESC + (-y) + 'A';
415
+ } else if (y > 0) {
416
+ ret += ESC + y + 'B';
417
+ }
418
+
419
+ return ret;
420
+ };
421
+
422
+ x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
423
+ x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
424
+ x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
425
+ x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
426
+
427
+ x.cursorLeft = ESC + 'G';
428
+ x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
429
+ x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
430
+ x.cursorGetPosition = ESC + '6n';
431
+ x.cursorNextLine = ESC + 'E';
432
+ x.cursorPrevLine = ESC + 'F';
433
+ x.cursorHide = ESC + '?25l';
434
+ x.cursorShow = ESC + '?25h';
435
+
436
+ x.eraseLines = count => {
437
+ let clear = '';
438
+
439
+ for (let i = 0; i < count; i++) {
440
+ clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
441
+ }
442
+
443
+ if (count) {
444
+ clear += x.cursorLeft;
445
+ }
446
+
447
+ return clear;
448
+ };
449
+
450
+ x.eraseEndLine = ESC + 'K';
451
+ x.eraseStartLine = ESC + '1K';
452
+ x.eraseLine = ESC + '2K';
453
+ x.eraseDown = ESC + 'J';
454
+ x.eraseUp = ESC + '1J';
455
+ x.eraseScreen = ESC + '2J';
456
+ x.scrollUp = ESC + 'S';
457
+ x.scrollDown = ESC + 'T';
458
+
459
+ x.clearScreen = '\u001Bc';
460
+
461
+ x.clearTerminal = process.platform === 'win32' ?
462
+ `${x.eraseScreen}${ESC}0f` :
463
+ // 1. Erases the screen (Only done in case `2` is not supported)
464
+ // 2. Erases the whole screen including scrollback buffer
465
+ // 3. Moves cursor to the top-left position
466
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
467
+ `${x.eraseScreen}${ESC}3J${ESC}H`;
468
+
469
+ x.beep = BEL;
470
+
471
+ x.link = (text, url) => {
472
+ return [
473
+ OSC,
474
+ '8',
475
+ SEP,
476
+ SEP,
477
+ url,
478
+ BEL,
479
+ text,
480
+ OSC,
481
+ '8',
482
+ SEP,
483
+ SEP,
484
+ BEL
485
+ ].join('');
486
+ };
487
+
488
+ x.image = (buf, opts) => {
489
+ opts = opts || {};
490
+
491
+ let ret = OSC + '1337;File=inline=1';
492
+
493
+ if (opts.width) {
494
+ ret += `;width=${opts.width}`;
495
+ }
496
+
497
+ if (opts.height) {
498
+ ret += `;height=${opts.height}`;
499
+ }
500
+
501
+ if (opts.preserveAspectRatio === false) {
502
+ ret += ';preserveAspectRatio=0';
503
+ }
504
+
505
+ return ret + ':' + buf.toString('base64') + BEL;
506
+ };
507
+
508
+ x.iTerm = {};
509
+
510
+ x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL;
511
+
512
+
513
+ /***/ }),
514
+
515
+ /***/ 39340:
516
+ /***/ ((__unused_webpack_module, exports) => {
517
+
518
+
519
+
520
+ Object.defineProperty(exports, "__esModule", ({
521
+ value: true
522
+ }));
523
+ exports.withPromise = exports.withCallback = void 0;
524
+
525
+ /**
526
+ * Open the input with a normal callback function
527
+ *
528
+ * @param {Input} input - input object
529
+ * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
530
+ * @param {function} callback - callback function
531
+ */
532
+ const withCallback = (input, valueMapper, callback) => {
533
+ input.open();
534
+ input.onSelect((id, value) => callback(valueMapper(id, value)));
535
+ };
536
+ /**
537
+ * Open the input with a promise
538
+ *
539
+ * @param {Input} input - input object
540
+ * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
541
+ */
542
+
543
+
544
+ exports.withCallback = withCallback;
545
+
546
+ const withPromise = (input, valueMapper) => {
547
+ return new Promise((resolve, reject) => {
548
+ input.open();
549
+ input.onSelect((id, value) => {
550
+ if (id === null) {
551
+ reject();
552
+ } else {
553
+ resolve(valueMapper(id, value));
554
+ }
555
+ });
556
+ });
557
+ };
558
+
559
+ exports.withPromise = withPromise;
560
+
561
+ /***/ }),
562
+
563
+ /***/ 99398:
564
+ /***/ ((module, exports, __webpack_require__) => {
565
+
566
+
567
+
568
+ Object.defineProperty(exports, "__esModule", ({
569
+ value: true
570
+ }));
571
+ exports["default"] = void 0;
572
+
573
+ var _input = _interopRequireDefault(__webpack_require__(25730));
574
+
575
+ var _renderer = _interopRequireDefault(__webpack_require__(16059));
576
+
577
+ var _callbackMappers = __webpack_require__(39340);
578
+
579
+ var _valueMappers = __webpack_require__(26730);
580
+
581
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
582
+
583
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
584
+
585
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
586
+
587
+ /**
588
+ * Default options
589
+ */
590
+ const defaultOptions = {
591
+ outputStream: process.stdout,
592
+ inputStream: process.stdin,
593
+ values: [],
594
+ defaultValue: 0,
595
+ selected: '(x)',
596
+ unselected: '( )',
597
+ indentation: 0,
598
+ cleanup: true,
599
+ valueRenderer: value => value
600
+ };
601
+ /**
602
+ * Create an instance of cli-select with the given options
603
+ *
604
+ * @param {object} options - options for cli-select
605
+ * @param {function} callback - if specified, a callback will be used, otherwise a promise gets returned (optional)
606
+ */
607
+
608
+ const creator = (options, callback) => {
609
+ // merge options with default options
610
+ options = _objectSpread({}, defaultOptions, options); // create renderer and input instances
611
+
612
+ const renderer = new _renderer.default(options, options.outputStream);
613
+ const input = new _input.default(options.inputStream);
614
+ input.setDefaultValue(options.defaultValue);
615
+ input.attachRenderer(renderer); // handle array and object values
616
+
617
+ let valueMapper;
618
+
619
+ if (Array.isArray(options.values)) {
620
+ valueMapper = (0, _valueMappers.withArrayValues)(options);
621
+ } else {
622
+ valueMapper = (0, _valueMappers.withObjectValues)(options);
623
+ } // map values
624
+
625
+
626
+ options.values = valueMapper.input;
627
+ input.setValues(options.values); // handle different callback methods
628
+
629
+ if (typeof callback === 'function') {
630
+ return (0, _callbackMappers.withCallback)(input, valueMapper.output, callback);
631
+ } else {
632
+ return (0, _callbackMappers.withPromise)(input, valueMapper.output);
633
+ }
634
+ };
635
+
636
+ exports = module.exports = creator;
637
+ Object.defineProperty(exports, "__esModule", ({
638
+ value: true
639
+ }));
640
+ var _default = creator;
641
+ exports["default"] = _default;
642
+
643
+ /***/ }),
644
+
645
+ /***/ 25730:
646
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
647
+
648
+
649
+
650
+ Object.defineProperty(exports, "__esModule", ({
651
+ value: true
652
+ }));
653
+ exports["default"] = void 0;
654
+
655
+ var _readline = _interopRequireDefault(__webpack_require__(14521));
656
+
657
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
658
+
659
+ /**
660
+ * Handle cli input
661
+ */
662
+ class Input {
663
+ /**
664
+ * Input constructor
665
+ *
666
+ * @param {any} stream - stream to catch (optional)
667
+ */
668
+ constructor(stream = process.stdin) {
669
+ // set default values
670
+ this.stream = stream;
671
+ this.values = [];
672
+ this.selectedValue = 0;
673
+
674
+ this.onSelectListener = () => {};
675
+
676
+ this.onKeyPress = this.onKeyPress.bind(this);
677
+ }
678
+ /**
679
+ * Set the available values
680
+ *
681
+ * @param {array} values - all available values
682
+ */
683
+
684
+
685
+ setValues(values) {
686
+ this.values = values;
687
+
688
+ if (this.renderer) {
689
+ this.renderer.setValues(values);
690
+ }
691
+ }
692
+ /**
693
+ * Set the default value
694
+ *
695
+ * @param {number} defaultValue - default value id
696
+ */
697
+
698
+
699
+ setDefaultValue(defaultValue) {
700
+ this.selectedValue = defaultValue;
701
+ }
702
+ /**
703
+ * Attach a renderer to the input catcher
704
+ *
705
+ * @param {Renderer} renderer - renderer to use for rendering responses
706
+ */
707
+
708
+
709
+ attachRenderer(renderer) {
710
+ this.renderer = renderer;
711
+ this.renderer.setValues(this.values);
712
+ }
713
+ /**
714
+ * Register an on select listener
715
+ *
716
+ * @param {function} listener - listener function which receives two parameters: valueId and value
717
+ */
718
+
719
+
720
+ onSelect(listener) {
721
+ this.onSelectListener = listener;
722
+ }
723
+ /**
724
+ * Open the stream and listen for input
725
+ */
726
+
727
+
728
+ open() {
729
+ // register keypress event
730
+ _readline.default.emitKeypressEvents(this.stream); // handle keypress
731
+
732
+
733
+ this.stream.on('keypress', this.onKeyPress); // initially render the response
734
+
735
+ if (this.renderer) {
736
+ this.renderer.render(this.selectedValue);
737
+ } // hide pressed keys and start listening on input
738
+
739
+
740
+ this.stream.setRawMode(true);
741
+ this.stream.resume();
742
+ }
743
+ /**
744
+ * Close the stream
745
+ *
746
+ * @param {boolean} cancelled - true if no value was selected (optional)
747
+ */
748
+
749
+
750
+ close(cancelled = false) {
751
+ // reset stream properties
752
+ this.stream.setRawMode(false);
753
+ this.stream.pause(); // cleanup the output
754
+
755
+ if (this.renderer) {
756
+ this.renderer.cleanup();
757
+ } // call the on select listener
758
+
759
+
760
+ if (cancelled) {
761
+ this.onSelectListener(null);
762
+ } else {
763
+ this.onSelectListener(this.selectedValue, this.values[this.selectedValue]);
764
+ }
765
+
766
+ this.stream.removeListener('keypress', this.onKeyPress);
767
+ }
768
+ /**
769
+ * Render the response
770
+ */
771
+
772
+
773
+ render() {
774
+ if (!this.renderer) {
775
+ return;
776
+ }
777
+
778
+ this.renderer.render(this.selectedValue);
779
+ }
780
+ /**
781
+ * Handle key press event
782
+ *
783
+ * @param {string} string - input string
784
+ * @param {object} key - object containing information about the pressed key
785
+ */
786
+
787
+
788
+ onKeyPress(string, key) {
789
+ if (key) {
790
+ if (key.name === 'up' && this.selectedValue > 0) {
791
+ this.selectedValue--;
792
+ this.render();
793
+ } else if (key.name === 'down' && this.selectedValue + 1 < this.values.length) {
794
+ this.selectedValue++;
795
+ this.render();
796
+ } else if (key.name === 'return') {
797
+ this.close();
798
+ } else if (key.name === 'escape' || key.name === 'c' && key.ctrl) {
799
+ this.close(true);
800
+ }
801
+ }
802
+ }
803
+
804
+ }
805
+
806
+ exports["default"] = Input;
807
+
808
+ /***/ }),
809
+
810
+ /***/ 16059:
811
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
812
+
813
+
814
+
815
+ Object.defineProperty(exports, "__esModule", ({
816
+ value: true
817
+ }));
818
+ exports["default"] = void 0;
819
+
820
+ var _readline = _interopRequireDefault(__webpack_require__(14521));
821
+
822
+ var _ansiEscapes = __webpack_require__(18512);
823
+
824
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
825
+
826
+ /**
827
+ * Response renderer
828
+ */
829
+ class Renderer {
830
+ /**
831
+ * Renderer constructor
832
+ *
833
+ * @param {object} options - renderer options
834
+ * @param {any} stream - stream to write to (optional)
835
+ */
836
+ constructor(options, stream = process.stdout) {
837
+ this.options = options;
838
+ this.stream = stream;
839
+ this.values = [];
840
+ this.initialRender = true;
841
+ }
842
+ /**
843
+ * Set the available values
844
+ *
845
+ * @param {array} values - all available values
846
+ */
847
+
848
+
849
+ setValues(values) {
850
+ this.values = values;
851
+ }
852
+ /**
853
+ * Render the values
854
+ *
855
+ * @param {number} selectedValue - selected value (optional)
856
+ */
857
+
858
+
859
+ render(selectedValue = 0) {
860
+ if (this.initialRender) {
861
+ // hide the cursor initially
862
+ this.initialRender = false;
863
+ this.stream.write(_ansiEscapes.cursorHide);
864
+ } else {
865
+ // remove previous lines and values
866
+ this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
867
+ } // output the current values
868
+
869
+
870
+ this.values.forEach((value, index) => {
871
+ const symbol = selectedValue === index ? this.options.selected : this.options.unselected;
872
+ const indentation = ' '.repeat(this.options.indentation);
873
+ const renderedValue = this.options.valueRenderer(value, selectedValue === index);
874
+ const end = index !== this.values.length - 1 ? '\n' : '';
875
+ this.stream.write(indentation + symbol + ' ' + renderedValue + end);
876
+ });
877
+ }
878
+ /**
879
+ * Cleanup the console at the end
880
+ */
881
+
882
+
883
+ cleanup() {
884
+ this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
885
+ this.stream.write(_ansiEscapes.cursorShow);
886
+ }
887
+
888
+ }
889
+
890
+ exports["default"] = Renderer;
891
+
892
+ /***/ }),
893
+
894
+ /***/ 26730:
895
+ /***/ ((__unused_webpack_module, exports) => {
896
+
897
+
898
+
899
+ Object.defineProperty(exports, "__esModule", ({
900
+ value: true
901
+ }));
902
+ exports.withObjectValues = exports.withArrayValues = void 0;
903
+
904
+ /**
905
+ * Map incoming and outgoing values if the initial values are an array
906
+ *
907
+ * @param {object} options - cli-select options
908
+ */
909
+ const withArrayValues = options => {
910
+ return {
911
+ input: options.values,
912
+ output: (id, value) => {
913
+ return {
914
+ id,
915
+ value
916
+ };
917
+ }
918
+ };
919
+ };
920
+ /**
921
+ * Map incoming and outgoing values if the initial values are an object
922
+ *
923
+ * @param {object} options - cli-select options
924
+ */
925
+
926
+
927
+ exports.withArrayValues = withArrayValues;
928
+
929
+ const withObjectValues = options => {
930
+ const originalValues = options.values;
931
+ return {
932
+ input: Object.values(originalValues),
933
+ output: (id, value) => {
934
+ return {
935
+ id: Object.keys(originalValues)[id],
936
+ value
937
+ };
938
+ }
939
+ };
940
+ };
941
+
942
+ exports.withObjectValues = withObjectValues;
943
+
944
+ /***/ }),
945
+
946
+ /***/ 76030:
947
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
948
+
949
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
950
+ /* harmony export */ "r": () => (/* binding */ symToStr)
951
+ /* harmony export */ });
952
+ /** @see <https://docs.tsafe.dev/main/symtostr> */
953
+ function symToStr(wrap) {
954
+ // @ts-expect-error: We know better
955
+ return Object.keys(wrap)[0];
956
+ }
957
+
958
+
959
+ //# sourceMappingURL=symToStr.mjs.map
960
+
961
+
962
+ /***/ })
963
+
964
+ };
965
+ ;