keycloakify 11.8.33 → 11.8.35-rc.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/bin/780.index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.id = 780;
3
- exports.ids = [780,786];
3
+ exports.ids = [780];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 75780:
@@ -81,8 +81,6 @@ function updateAccountThemeImplementationInConfig(params) {
81
81
  }
82
82
  }
83
83
  //# sourceMappingURL=updateAccountThemeImplementationInConfig.js.map
84
- // EXTERNAL MODULE: ./dist/bin/update-kc-gen.js
85
- var update_kc_gen = __webpack_require__(10786);
86
84
  // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
87
85
  var customHandler_delegate = __webpack_require__(72138);
88
86
  // EXTERNAL MODULE: ./dist/bin/shared/exitIfUncommittedChanges.js
@@ -98,7 +96,6 @@ var getThisCodebaseRootDirPath = __webpack_require__(58822);
98
96
 
99
97
 
100
98
 
101
-
102
99
  async function command(params) {
103
100
  const { buildContext } = params;
104
101
  const { hasBeenHandled } = await (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
@@ -125,12 +122,20 @@ async function command(params) {
125
122
  console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
126
123
  process.exit(-1);
127
124
  }
125
+ updateAccountThemeImplementationInConfig({
126
+ buildContext,
127
+ accountThemeType
128
+ });
128
129
  external_fs_.cpSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "initialize-account-theme", "multi-page-boilerplate"), accountThemeSrcDirPath, { recursive: true });
129
130
  }
130
131
  break;
131
132
  case "Single-Page":
132
133
  {
133
- const { initializeSpa } = await Promise.all(/* import() */[__webpack_require__.e(502), __webpack_require__.e(656)]).then(__webpack_require__.bind(__webpack_require__, 98656));
134
+ updateAccountThemeImplementationInConfig({
135
+ buildContext,
136
+ accountThemeType
137
+ });
138
+ const { initializeSpa } = await Promise.all(/* import() */[__webpack_require__.e(84), __webpack_require__.e(698)]).then(__webpack_require__.bind(__webpack_require__, 98656));
134
139
  await initializeSpa({
135
140
  themeType: "account",
136
141
  buildContext
@@ -138,13 +143,6 @@ async function command(params) {
138
143
  }
139
144
  break;
140
145
  }
141
- updateAccountThemeImplementationInConfig({ buildContext, accountThemeType });
142
- await (0,update_kc_gen.command)({
143
- buildContext: Object.assign(Object.assign({}, buildContext), { implementedThemeTypes: Object.assign(Object.assign({}, buildContext.implementedThemeTypes), { account: {
144
- isImplemented: true,
145
- type: accountThemeType
146
- } }) })
147
- });
148
146
  }
149
147
  //# sourceMappingURL=initialize-account-theme.js.map
150
148
  ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/index.js
@@ -503,270 +501,6 @@ function getNodeModulesBinDirPath(params) {
503
501
 
504
502
  /***/ }),
505
503
 
506
- /***/ 48433:
507
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
508
-
509
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
510
- /* harmony export */ "LG": () => (/* binding */ getPrettier),
511
- /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
512
- /* harmony export */ "eY": () => (/* binding */ runPrettier)
513
- /* harmony export */ });
514
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
515
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
516
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
517
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
518
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
519
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
520
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
521
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
522
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
523
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
524
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
525
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
526
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
527
- /* module decorator */ module = __webpack_require__.hmd(module);
528
-
529
-
530
-
531
-
532
-
533
-
534
-
535
-
536
-
537
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
538
- async function getIsPrettierAvailable() {
539
- var _a;
540
- if (getIsPrettierAvailable.cache !== undefined) {
541
- return getIsPrettierAvailable.cache;
542
- }
543
- const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({
544
- packageJsonFilePath: undefined
545
- });
546
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
547
- const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
548
- const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
549
- getIsPrettierAvailable.cache = isPrettierAvailable;
550
- return isPrettierAvailable;
551
- }
552
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
553
- async function getPrettier() {
554
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
555
- if (getPrettier.cache !== undefined) {
556
- return getPrettier.cache;
557
- }
558
- let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
559
- import_prettier: {
560
- // NOTE: When module is linked we want to make sure we import the correct version
561
- // of prettier, that is the one of the project, not the one of this repo.
562
- // So we do a sketchy eval to bypass ncc.
563
- // We make sure to only do that when linking, otherwise we import properly.
564
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
565
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", "prettier"));
566
- const isCJS = true && module.exports;
567
- if (isCJS) {
568
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${prettierDirPath}")`);
569
- }
570
- else {
571
- prettier = await new Promise(_resolve => {
572
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_1__.join)(prettierDirPath, "index.mjs").replace(/\\/g, "/")}").then(prettier => _resolve(prettier))`);
573
- });
574
- }
575
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
576
- break import_prettier;
577
- }
578
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
579
- }
580
- const configHash = await (async () => {
581
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", ".."));
582
- if (configFilePath === null) {
583
- return "";
584
- }
585
- const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
586
- return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
587
- })();
588
- const prettierAndConfig = {
589
- prettier,
590
- configHash
591
- };
592
- getPrettier.cache = prettierAndConfig;
593
- return prettierAndConfig;
594
- }
595
- async function runPrettier(params) {
596
- const { sourceCode, filePath } = params;
597
- let formattedSourceCode;
598
- try {
599
- const { prettier } = await getPrettier();
600
- const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
601
- resolveConfig: true
602
- });
603
- if (ignored || inferredParser === null) {
604
- return sourceCode;
605
- }
606
- const config = await prettier.resolveConfig(filePath);
607
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
608
- }
609
- catch (error) {
610
- console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
611
- throw error;
612
- }
613
- return formattedSourceCode;
614
- }
615
- //# sourceMappingURL=runPrettier.js.map
616
-
617
- /***/ }),
618
-
619
- /***/ 10786:
620
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
621
-
622
- __webpack_require__.r(__webpack_exports__);
623
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
624
- /* harmony export */ "command": () => (/* binding */ command)
625
- /* harmony export */ });
626
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
627
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
628
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
629
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
630
- /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43765);
631
- /* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72138);
632
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6113);
633
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_4__);
634
- /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48433);
635
-
636
-
637
-
638
-
639
-
640
-
641
- async function command(params) {
642
- const { buildContext } = params;
643
- run_copy_assets_to_public: {
644
- if (buildContext.bundler !== "webpack") {
645
- break run_copy_assets_to_public;
646
- }
647
- const { command } = await __webpack_require__.e(/* import() */ 658).then(__webpack_require__.bind(__webpack_require__, 18040));
648
- await command({ buildContext });
649
- }
650
- const { hasBeenHandled } = await (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
651
- commandName: "update-kc-gen",
652
- buildContext
653
- });
654
- if (hasBeenHandled) {
655
- return;
656
- }
657
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
658
- const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
659
- const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
660
- const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
661
- let newContent = [
662
- ``,
663
- `/* eslint-disable */`,
664
- ``,
665
- `// @ts-nocheck`,
666
- ``,
667
- `// noinspection JSUnusedGlobalSymbols`,
668
- ``,
669
- `import { lazy, Suspense, type ReactNode } from "react";`,
670
- ``,
671
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
672
- ``,
673
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
674
- ``,
675
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
676
- ``,
677
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
678
- ``,
679
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
680
- ``,
681
- `/**`,
682
- ` * NOTE: Do not import this type except maybe in your entrypoint. `,
683
- ` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
684
- ` * Depending on the theme type you are working on.`,
685
- ` */`,
686
- `export type KcContext =`,
687
- hasLoginTheme && ` | import("./login/KcContext").KcContext`,
688
- hasAccountTheme && ` | import("./account/KcContext").KcContext`,
689
- hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
690
- ` ;`,
691
- ``,
692
- `declare global {`,
693
- ` interface Window {`,
694
- ` kcContext?: KcContext;`,
695
- ` }`,
696
- `}`,
697
- ``,
698
- hasLoginTheme &&
699
- `export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
700
- hasAccountTheme &&
701
- `export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
702
- hasAdminTheme &&
703
- `export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
704
- ``,
705
- `export function KcPage(`,
706
- ` props: {`,
707
- ` kcContext: KcContext;`,
708
- ` fallback?: ReactNode;`,
709
- ` }`,
710
- `) {`,
711
- ` const { kcContext, fallback } = props;`,
712
- ` return (`,
713
- ` <Suspense fallback={fallback}>`,
714
- ` {(() => {`,
715
- ` switch (kcContext.themeType) {`,
716
- hasLoginTheme &&
717
- ` case "login": return <KcLoginPage kcContext={kcContext} />;`,
718
- hasAccountTheme &&
719
- ` case "account": return <KcAccountPage kcContext={kcContext} />;`,
720
- hasAdminTheme &&
721
- ` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
722
- ` }`,
723
- ` })()}`,
724
- ` </Suspense>`,
725
- ` );`,
726
- `}`,
727
- ``
728
- ]
729
- .filter(item => typeof item === "string")
730
- .join("\n");
731
- const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
732
- skip_if_no_changes: {
733
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
734
- break skip_if_no_changes;
735
- }
736
- const currentContent = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
737
- if (!currentContent.includes(hash)) {
738
- break skip_if_no_changes;
739
- }
740
- return;
741
- }
742
- newContent = [
743
- `// This file is auto-generated by the \`update-kc-gen\` command. Do not edit it manually.`,
744
- `// Hash: ${hash}`,
745
- ``,
746
- newContent
747
- ].join("\n");
748
- format: {
749
- if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .getIsPrettierAvailable */ .MT)())) {
750
- break format;
751
- }
752
- newContent = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .runPrettier */ .eY)({
753
- filePath,
754
- sourceCode: newContent
755
- });
756
- }
757
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from(newContent, "utf8"));
758
- delete_legacy_file: {
759
- const legacyFilePath = filePath.replace(/tsx$/, "ts");
760
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(legacyFilePath))) {
761
- break delete_legacy_file;
762
- }
763
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.unlink(legacyFilePath);
764
- }
765
- }
766
- //# sourceMappingURL=update-kc-gen.js.map
767
-
768
- /***/ }),
769
-
770
504
  /***/ 18512:
771
505
  /***/ ((module) => {
772
506
 
@@ -1334,24 +1068,6 @@ const withObjectValues = options => {
1334
1068
 
1335
1069
  exports.withObjectValues = withObjectValues;
1336
1070
 
1337
- /***/ }),
1338
-
1339
- /***/ 76030:
1340
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1341
-
1342
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1343
- /* harmony export */ "r": () => (/* binding */ symToStr)
1344
- /* harmony export */ });
1345
- /** @see <https://docs.tsafe.dev/main/symtostr> */
1346
- function symToStr(wrap) {
1347
- // @ts-expect-error: We know better
1348
- return Object.keys(wrap)[0];
1349
- }
1350
-
1351
-
1352
- //# sourceMappingURL=symToStr.mjs.map
1353
-
1354
-
1355
1071
  /***/ })
1356
1072
 
1357
1073
  };
@@ -1,60 +1,8 @@
1
1
  "use strict";
2
- exports.id = 502;
3
- exports.ids = [502];
2
+ exports.id = 84;
3
+ exports.ids = [84];
4
4
  exports.modules = {
5
5
 
6
- /***/ 80339:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "N": () => (/* binding */ addSyncExtensionsToPostinstallScript)
11
- /* harmony export */ });
12
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
13
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
14
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29041);
15
-
16
-
17
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .h)();
18
- function addSyncExtensionsToPostinstallScript(params) {
19
- var _a;
20
- const { parsedPackageJson, buildContext } = params;
21
- const cmd_base = "keycloakify sync-extensions";
22
- const projectCliOptionValue = (() => {
23
- const packageJsonDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(buildContext.packageJsonFilePath);
24
- const relativePath = (0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(packageJsonDirPath, buildContext.projectDirPath);
25
- if (relativePath === "") {
26
- return undefined;
27
- }
28
- return relativePath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).join("/");
29
- })();
30
- const generateCmd = (params) => {
31
- const { cmd_preexisting } = params;
32
- let cmd = cmd_preexisting === undefined ? "" : `${cmd_preexisting} && `;
33
- cmd += cmd_base;
34
- if (projectCliOptionValue !== undefined) {
35
- cmd += ` -p ${projectCliOptionValue}`;
36
- }
37
- return cmd;
38
- };
39
- {
40
- const scripts = ((_a = parsedPackageJson.scripts) !== null && _a !== void 0 ? _a : (parsedPackageJson.scripts = {}));
41
- for (const scriptName of ["postinstall", "prepare"]) {
42
- const cmd_preexisting = scripts[scriptName];
43
- if (cmd_preexisting === undefined) {
44
- continue;
45
- }
46
- if (!cmd_preexisting.includes(cmd_base)) {
47
- scripts[scriptName] = generateCmd({ cmd_preexisting });
48
- return;
49
- }
50
- }
51
- }
52
- parsedPackageJson.scripts = Object.assign({ postinstall: generateCmd({ cmd_preexisting: undefined }) }, parsedPackageJson.scripts);
53
- }
54
- //# sourceMappingURL=addSyncExtensionsToPostinstallScript.js.map
55
-
56
- /***/ }),
57
-
58
6
  /***/ 12171:
59
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60
8
 
@@ -556,112 +504,116 @@ async function installWithoutBreakingLinks(params) {
556
504
 
557
505
  /***/ }),
558
506
 
559
- /***/ 50689:
560
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
507
+ /***/ 48433:
508
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
561
509
 
510
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
511
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
512
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
513
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
514
+ /* harmony export */ });
515
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
516
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
517
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
518
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
519
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
520
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
521
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
522
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
523
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
524
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
525
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
526
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
527
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
528
+ /* module decorator */ module = __webpack_require__.hmd(module);
562
529
 
563
- var __extends = (this && this.__extends) || (function () {
564
- var extendStatics = function (d, b) {
565
- extendStatics = Object.setPrototypeOf ||
566
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
567
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
568
- return extendStatics(d, b);
569
- };
570
- return function (d, b) {
571
- if (typeof b !== "function" && b !== null)
572
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
573
- extendStatics(d, b);
574
- function __() { this.constructor = d; }
575
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
576
- };
577
- })();
578
- Object.defineProperty(exports, "__esModule", ({ value: true }));
579
- exports.VoidDeferred = exports.Deferred = void 0;
580
- var overwriteReadonlyProp_1 = __webpack_require__(47803);
581
- var Deferred = /** @class */ (function () {
582
- function Deferred() {
583
- var _this_1 = this;
584
- this.isPending = true;
585
- var resolve;
586
- var reject;
587
- this.pr = new Promise(function (resolve_, reject_) {
588
- resolve = function (value) {
589
- (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
590
- resolve_(value);
591
- };
592
- reject = function (error) {
593
- (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
594
- reject_(error);
595
- };
596
- });
597
- this.resolve = resolve;
598
- this.reject = reject;
599
- }
600
- return Deferred;
601
- }());
602
- exports.Deferred = Deferred;
603
- var VoidDeferred = /** @class */ (function (_super) {
604
- __extends(VoidDeferred, _super);
605
- function VoidDeferred() {
606
- return _super !== null && _super.apply(this, arguments) || this;
607
- }
608
- return VoidDeferred;
609
- }(Deferred));
610
- exports.VoidDeferred = VoidDeferred;
611
- //# sourceMappingURL=Deferred.js.map
612
530
 
613
- /***/ }),
614
531
 
615
- /***/ 47803:
616
- /***/ (function(__unused_webpack_module, exports) {
617
532
 
618
533
 
619
- var __assign = (this && this.__assign) || function () {
620
- __assign = Object.assign || function(t) {
621
- for (var s, i = 1, n = arguments.length; i < n; i++) {
622
- s = arguments[i];
623
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
624
- t[p] = s[p];
625
- }
626
- return t;
627
- };
628
- return __assign.apply(this, arguments);
629
- };
630
- Object.defineProperty(exports, "__esModule", ({ value: true }));
631
- exports.overwriteReadonlyProp = void 0;
632
- /**
633
- * Assign a value to a property even if the object is freezed or if the property is not writable
634
- * Throw if the assignation fail ( for example if the property is non configurable write: false )
635
- * */
636
- var overwriteReadonlyProp = function (obj, propertyName, value) {
637
- try {
638
- obj[propertyName] = value;
534
+
535
+
536
+
537
+
538
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
539
+ async function getIsPrettierAvailable() {
540
+ var _a;
541
+ if (getIsPrettierAvailable.cache !== undefined) {
542
+ return getIsPrettierAvailable.cache;
543
+ }
544
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({
545
+ packageJsonFilePath: undefined
546
+ });
547
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
548
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
549
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
550
+ getIsPrettierAvailable.cache = isPrettierAvailable;
551
+ return isPrettierAvailable;
552
+ }
553
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
554
+ async function getPrettier() {
555
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
556
+ if (getPrettier.cache !== undefined) {
557
+ return getPrettier.cache;
639
558
  }
640
- catch (_a) { }
641
- if (obj[propertyName] === value) {
642
- return value;
559
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
560
+ import_prettier: {
561
+ // NOTE: When module is linked we want to make sure we import the correct version
562
+ // of prettier, that is the one of the project, not the one of this repo.
563
+ // So we do a sketchy eval to bypass ncc.
564
+ // We make sure to only do that when linking, otherwise we import properly.
565
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
566
+ const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", "prettier"));
567
+ const isCJS = true && module.exports;
568
+ if (isCJS) {
569
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${prettierDirPath}")`);
570
+ }
571
+ else {
572
+ prettier = await new Promise(_resolve => {
573
+ eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_1__.join)(prettierDirPath, "index.mjs").replace(/\\/g, "/")}").then(prettier => _resolve(prettier))`);
574
+ });
575
+ }
576
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
577
+ break import_prettier;
578
+ }
579
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
643
580
  }
644
- var errorDefineProperty = undefined;
645
- var propertyDescriptor = Object.getOwnPropertyDescriptor(obj, propertyName) || {
646
- "enumerable": true,
647
- "configurable": true,
581
+ const configHash = await (async () => {
582
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", ".."));
583
+ if (configFilePath === null) {
584
+ return "";
585
+ }
586
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
587
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
588
+ })();
589
+ const prettierAndConfig = {
590
+ prettier,
591
+ configHash
648
592
  };
649
- if (!!propertyDescriptor.get) {
650
- throw new Error("Probably a wrong ides to overwrite ".concat(String(propertyName), " getter"));
651
- }
593
+ getPrettier.cache = prettierAndConfig;
594
+ return prettierAndConfig;
595
+ }
596
+ async function runPrettier(params) {
597
+ const { sourceCode, filePath } = params;
598
+ let formattedSourceCode;
652
599
  try {
653
- Object.defineProperty(obj, propertyName, __assign(__assign({}, propertyDescriptor), { value: value }));
600
+ const { prettier } = await getPrettier();
601
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
602
+ resolveConfig: true
603
+ });
604
+ if (ignored || inferredParser === null) {
605
+ return sourceCode;
606
+ }
607
+ const config = await prettier.resolveConfig(filePath);
608
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
654
609
  }
655
610
  catch (error) {
656
- errorDefineProperty = error;
611
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
612
+ throw error;
657
613
  }
658
- if (obj[propertyName] !== value) {
659
- throw errorDefineProperty || new Error("Can't assign");
660
- }
661
- return value;
662
- };
663
- exports.overwriteReadonlyProp = overwriteReadonlyProp;
664
- //# sourceMappingURL=overwriteReadonlyProp.js.map
614
+ return formattedSourceCode;
615
+ }
616
+ //# sourceMappingURL=runPrettier.js.map
665
617
 
666
618
  /***/ })
667
619