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