keycloakify 11.8.45 → 11.8.47-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.
Files changed (98) hide show
  1. package/bin/254.index.js +283 -0
  2. package/bin/30.index.js +25 -0
  3. package/bin/{864.index.js → 309.index.js} +6944 -28439
  4. package/bin/311.index.js +198 -0
  5. package/bin/{313.index.js → 355.index.js} +101 -147
  6. package/bin/{84.index.js → 502.index.js} +147 -101
  7. package/bin/626.index.js +194 -0
  8. package/bin/{698.index.js → 656.index.js} +101 -147
  9. package/bin/675.index.js +177 -0
  10. package/bin/69.index.js +1 -1
  11. package/bin/762.index.js +1475 -0
  12. package/bin/780.index.js +4 -2
  13. package/bin/786.index.js +115 -0
  14. package/bin/895.index.js +21501 -0
  15. package/bin/{618.index.js → 932.index.js} +117 -163
  16. package/bin/949.index.js +1 -1
  17. package/bin/97.index.js +537 -4
  18. package/bin/init/index.d.ts +1 -0
  19. package/bin/init/init.d.ts +3 -0
  20. package/bin/init/setupEslint.d.ts +4 -0
  21. package/bin/init/setupVitePluginIfNeeded.d.ts +4 -0
  22. package/bin/initialize-login-theme.d.ts +4 -0
  23. package/bin/main.js +19 -30
  24. package/bin/shared/customHandler.d.ts +1 -1
  25. package/bin/shared/customHandler.js.map +1 -1
  26. package/package.json +82 -66
  27. package/src/bin/init/index.ts +1 -0
  28. package/src/bin/init/init.ts +354 -0
  29. package/src/bin/init/setupEslint.ts +80 -0
  30. package/src/bin/init/setupVitePluginIfNeeded.ts +143 -0
  31. package/src/bin/initialize-account-theme/initialize-account-theme.ts +4 -0
  32. package/src/bin/initialize-login-theme.ts +323 -0
  33. package/src/bin/main.ts +14 -0
  34. package/src/bin/shared/buildContext.ts +2 -37
  35. package/src/bin/shared/customHandler.ts +3 -1
  36. package/src/bin/sync-extensions/extensionModuleMeta.ts +89 -73
  37. package/src/bin/sync-extensions/managedGitignoreFiles.ts +32 -2
  38. package/vite-plugin/index.js +1 -24
  39. package/bin/433.index.js +0 -140
  40. /package/res/public/keycloakify-dev-resources/account/{account/css → css}/account.css +0 -0
  41. /package/res/public/keycloakify-dev-resources/account/{account/img → img}/icon-sidebar-active.png +0 -0
  42. /package/res/public/keycloakify-dev-resources/account/{account/img → img}/keycloak-logo.png +0 -0
  43. /package/res/public/keycloakify-dev-resources/account/{account/img → img}/logo.png +0 -0
  44. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/img/favicon.ico +0 -0
  45. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/css/patternfly-additions.min.css +0 -0
  46. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/css/patternfly.min.css +0 -0
  47. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
  48. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
  49. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
  50. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
  51. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
  52. /package/res/public/keycloakify-dev-resources/account/{account/resources-common → resources-common}/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
  53. /package/res/public/keycloakify-dev-resources/login/{login/css → css}/login.css +0 -0
  54. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-error-arrow-down.png +0 -0
  55. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-error-sign.png +0 -0
  56. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-success-arrow-down.png +0 -0
  57. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-success-sign.png +0 -0
  58. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-warning-arrow-down.png +0 -0
  59. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/feedback-warning-sign.png +0 -0
  60. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/keycloak-bg.png +0 -0
  61. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/keycloak-logo-text.png +0 -0
  62. /package/res/public/keycloakify-dev-resources/login/{login/img → img}/keycloak-logo.png +0 -0
  63. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/authChecker.js +0 -0
  64. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/common.js +0 -0
  65. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/kcMultivalued.js +0 -0
  66. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/kcNumberFormat.js +0 -0
  67. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/kcNumberUnFormat.js +0 -0
  68. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/menu-button-links.js +0 -0
  69. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/passkeysConditionalAuth.js +0 -0
  70. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/passwordVisibility.js +0 -0
  71. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/userProfile.js +0 -0
  72. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/webauthnAuthenticate.js +0 -0
  73. /package/res/public/keycloakify-dev-resources/login/{login/js → js}/webauthnRegister.js +0 -0
  74. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/img/favicon.ico +0 -0
  75. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/lib/pficon/pficon.css +0 -0
  76. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/lib/pficon/pficon.woff2 +0 -0
  77. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/@patternfly/patternfly/assets/fonts/RedHatDisplay/RedHatDisplay-Bold.woff +0 -0
  78. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/@patternfly/patternfly/assets/fonts/RedHatDisplay/RedHatDisplay-Bold.woff2 +0 -0
  79. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/@patternfly/patternfly/assets/fonts/overpass-webfont/overpass-bold.woff +0 -0
  80. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/@patternfly/patternfly/assets/fonts/overpass-webfont/overpass-bold.woff2 +0 -0
  81. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/@patternfly/patternfly/patternfly.min.css +0 -0
  82. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/jquery/dist/jquery.min.js +0 -0
  83. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/css/patternfly-additions.min.css +0 -0
  84. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/css/patternfly.min.css +0 -0
  85. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.ttf +0 -0
  86. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff +0 -0
  87. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
  88. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
  89. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
  90. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
  91. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  92. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  93. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/OpenSans-SemiboldItalic-webfont.woff2 +0 -0
  94. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
  95. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
  96. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/fonts/fontawesome-webfont.woff2 +0 -0
  97. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/patternfly/dist/img/bg-login.jpg +0 -0
  98. /package/res/public/keycloakify-dev-resources/login/{login/resources-common → resources-common}/node_modules/rfc4648/lib/rfc4648.js +0 -0
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ exports.id = 311;
3
+ exports.ids = [311];
4
+ exports.modules = {
5
+
6
+ /***/ 75780:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ // ESM COMPAT FLAG
10
+ __webpack_require__.r(__webpack_exports__);
11
+
12
+ // EXPORTS
13
+ __webpack_require__.d(__webpack_exports__, {
14
+ "command": () => (/* reexport */ command)
15
+ });
16
+
17
+ // EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
18
+ var dist = __webpack_require__(99398);
19
+ var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
20
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
21
+ var source = __webpack_require__(78818);
22
+ var source_default = /*#__PURE__*/__webpack_require__.n(source);
23
+ // EXTERNAL MODULE: external "path"
24
+ var external_path_ = __webpack_require__(71017);
25
+ // EXTERNAL MODULE: external "fs"
26
+ var external_fs_ = __webpack_require__(57147);
27
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
28
+ var assert = __webpack_require__(29041);
29
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
30
+ var lib = __webpack_require__(52300);
31
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
32
+ var id = __webpack_require__(38469);
33
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.js
34
+
35
+
36
+
37
+
38
+
39
+
40
+ (0,assert/* assert */.h)();
41
+ function updateAccountThemeImplementationInConfig(params) {
42
+ const { buildContext, accountThemeType } = params;
43
+ switch (buildContext.bundler) {
44
+ case "vite":
45
+ {
46
+ const viteConfigPath = (0,external_path_.join)(buildContext.projectDirPath, "vite.config.ts");
47
+ if (!external_fs_.existsSync(viteConfigPath)) {
48
+ console.log(source_default().bold(`You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite config`));
49
+ break;
50
+ }
51
+ const viteConfigContent = external_fs_.readFileSync(viteConfigPath)
52
+ .toString("utf8");
53
+ const modifiedViteConfigContent = viteConfigContent.replace(/accountThemeImplementation\s*:\s*"none"/, `accountThemeImplementation: "${accountThemeType}"`);
54
+ if (modifiedViteConfigContent === viteConfigContent) {
55
+ console.log(source_default().bold(`You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite.config.ts`));
56
+ break;
57
+ }
58
+ external_fs_.writeFileSync(viteConfigPath, modifiedViteConfigContent);
59
+ }
60
+ break;
61
+ case "webpack":
62
+ {
63
+ const parsedPackageJson = (() => {
64
+ const zParsedPackageJson = (() => {
65
+ const zTargetType = lib.z.object({
66
+ keycloakify: lib.z.record(lib.z.unknown())
67
+ });
68
+ (0,assert/* assert */.h)();
69
+ return (0,id.id)(zTargetType);
70
+ })();
71
+ const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
72
+ zParsedPackageJson.parse(parsedPackageJson);
73
+ (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
74
+ return parsedPackageJson;
75
+ })();
76
+ parsedPackageJson.keycloakify.accountThemeImplementation =
77
+ accountThemeType;
78
+ external_fs_.writeFileSync(buildContext.packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, undefined, 4), "utf8"));
79
+ }
80
+ break;
81
+ }
82
+ }
83
+ //# sourceMappingURL=updateAccountThemeImplementationInConfig.js.map
84
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
85
+ var customHandler_delegate = __webpack_require__(72138);
86
+ // EXTERNAL MODULE: ./dist/bin/shared/exitIfUncommittedChanges.js
87
+ var exitIfUncommittedChanges = __webpack_require__(22058);
88
+ // EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
89
+ var getThisCodebaseRootDirPath = __webpack_require__(58822);
90
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/initialize-account-theme.js
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ async function command(params) {
100
+ const { buildContext } = params;
101
+ const { hasBeenHandled } = await (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
102
+ commandName: "initialize-account-theme",
103
+ buildContext
104
+ });
105
+ if (hasBeenHandled) {
106
+ return;
107
+ }
108
+ const accountThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "account");
109
+ (0,exitIfUncommittedChanges/* exitIfUncommittedChanges */.l)({
110
+ projectDirPath: buildContext.projectDirPath
111
+ });
112
+ console.log(source_default().cyan("Which account theme type?"));
113
+ const { value: accountThemeType } = await dist_default()({
114
+ values: ["Single-Page", "Multi-Page"]
115
+ }).catch(() => {
116
+ process.exit(-1);
117
+ });
118
+ console.log(`${accountThemeType}\n`);
119
+ switch (accountThemeType) {
120
+ case "Multi-Page":
121
+ {
122
+ if (external_fs_.existsSync(accountThemeSrcDirPath) &&
123
+ external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
124
+ console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
125
+ process.exit(-1);
126
+ }
127
+ updateAccountThemeImplementationInConfig({
128
+ buildContext,
129
+ accountThemeType
130
+ });
131
+ external_fs_.cpSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "initialize-account-theme", "multi-page-boilerplate"), accountThemeSrcDirPath, { recursive: true });
132
+ }
133
+ break;
134
+ case "Single-Page":
135
+ {
136
+ updateAccountThemeImplementationInConfig({
137
+ buildContext,
138
+ accountThemeType
139
+ });
140
+ const { initializeSpa } = await Promise.all(/* import() */[__webpack_require__.e(502), __webpack_require__.e(656)]).then(__webpack_require__.bind(__webpack_require__, 98656));
141
+ await initializeSpa({
142
+ themeType: "account",
143
+ buildContext
144
+ });
145
+ }
146
+ break;
147
+ }
148
+ }
149
+ //# sourceMappingURL=initialize-account-theme.js.map
150
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/index.js
151
+
152
+ //# sourceMappingURL=index.js.map
153
+
154
+ /***/ }),
155
+
156
+ /***/ 22058:
157
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
158
+
159
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
160
+ /* harmony export */ "l": () => (/* binding */ exitIfUncommittedChanges)
161
+ /* harmony export */ });
162
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32081);
163
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);
164
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(78818);
165
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__);
166
+
167
+
168
+ function exitIfUncommittedChanges(params) {
169
+ const { projectDirPath } = params;
170
+ let hasUncommittedChanges = undefined;
171
+ try {
172
+ hasUncommittedChanges =
173
+ child_process__WEBPACK_IMPORTED_MODULE_0___default().execSync(`git status --porcelain`, {
174
+ cwd: projectDirPath
175
+ })
176
+ .toString()
177
+ .trim() !== "";
178
+ }
179
+ catch (_a) {
180
+ // Probably not a git repository
181
+ return;
182
+ }
183
+ if (!hasUncommittedChanges) {
184
+ return;
185
+ }
186
+ console.warn([
187
+ chalk__WEBPACK_IMPORTED_MODULE_1___default().red("Please commit or stash your changes before running this command.\n"),
188
+ "This command will modify your project's files so it's better to have a clean working directory",
189
+ "so that you can easily see what has been changed and revert if needed."
190
+ ].join(" "));
191
+ process.exit(-1);
192
+ }
193
+ //# sourceMappingURL=exitIfUncommittedChanges.js.map
194
+
195
+ /***/ })
196
+
197
+ };
198
+ ;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.id = 313;
3
- exports.ids = [313,698];
2
+ exports.id = 355;
3
+ exports.ids = [355,30,626,656];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 60355:
@@ -37,58 +37,6 @@ async function command(params) {
37
37
 
38
38
  /***/ }),
39
39
 
40
- /***/ 80339:
41
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
42
-
43
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
44
- /* harmony export */ "N": () => (/* binding */ addSyncExtensionsToPostinstallScript)
45
- /* harmony export */ });
46
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
47
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
48
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29041);
49
-
50
-
51
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .h)();
52
- function addSyncExtensionsToPostinstallScript(params) {
53
- var _a;
54
- const { parsedPackageJson, buildContext } = params;
55
- const cmd_base = "keycloakify sync-extensions";
56
- const projectCliOptionValue = (() => {
57
- const packageJsonDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(buildContext.packageJsonFilePath);
58
- const relativePath = (0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(packageJsonDirPath, buildContext.projectDirPath);
59
- if (relativePath === "") {
60
- return undefined;
61
- }
62
- return relativePath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).join("/");
63
- })();
64
- const generateCmd = (params) => {
65
- const { cmd_preexisting } = params;
66
- let cmd = cmd_preexisting === undefined ? "" : `${cmd_preexisting} && `;
67
- cmd += cmd_base;
68
- if (projectCliOptionValue !== undefined) {
69
- cmd += ` -p ${projectCliOptionValue}`;
70
- }
71
- return cmd;
72
- };
73
- {
74
- const scripts = ((_a = parsedPackageJson.scripts) !== null && _a !== void 0 ? _a : (parsedPackageJson.scripts = {}));
75
- for (const scriptName of ["postinstall", "prepare"]) {
76
- const cmd_preexisting = scripts[scriptName];
77
- if (cmd_preexisting === undefined) {
78
- continue;
79
- }
80
- if (!cmd_preexisting.includes(cmd_base)) {
81
- scripts[scriptName] = generateCmd({ cmd_preexisting });
82
- return;
83
- }
84
- }
85
- }
86
- parsedPackageJson.scripts = Object.assign({ postinstall: generateCmd({ cmd_preexisting: undefined }) }, parsedPackageJson.scripts);
87
- }
88
- //# sourceMappingURL=addSyncExtensionsToPostinstallScript.js.map
89
-
90
- /***/ }),
91
-
92
40
  /***/ 72138:
93
41
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
94
42
 
@@ -551,112 +499,118 @@ function getNodeModulesBinDirPath(params) {
551
499
 
552
500
  /***/ }),
553
501
 
554
- /***/ 50689:
555
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
502
+ /***/ 48433:
503
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
556
504
 
505
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
506
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
507
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
508
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
509
+ /* harmony export */ });
510
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
511
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
512
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
513
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
514
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
515
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
516
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
517
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
518
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
519
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
520
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
521
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
522
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
523
+ /* module decorator */ module = __webpack_require__.hmd(module);
557
524
 
558
- var __extends = (this && this.__extends) || (function () {
559
- var extendStatics = function (d, b) {
560
- extendStatics = Object.setPrototypeOf ||
561
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
562
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
563
- return extendStatics(d, b);
564
- };
565
- return function (d, b) {
566
- if (typeof b !== "function" && b !== null)
567
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
568
- extendStatics(d, b);
569
- function __() { this.constructor = d; }
570
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
571
- };
572
- })();
573
- Object.defineProperty(exports, "__esModule", ({ value: true }));
574
- exports.VoidDeferred = exports.Deferred = void 0;
575
- var overwriteReadonlyProp_1 = __webpack_require__(47803);
576
- var Deferred = /** @class */ (function () {
577
- function Deferred() {
578
- var _this_1 = this;
579
- this.isPending = true;
580
- var resolve;
581
- var reject;
582
- this.pr = new Promise(function (resolve_, reject_) {
583
- resolve = function (value) {
584
- (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
585
- resolve_(value);
586
- };
587
- reject = function (error) {
588
- (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
589
- reject_(error);
590
- };
591
- });
592
- this.resolve = resolve;
593
- this.reject = reject;
594
- }
595
- return Deferred;
596
- }());
597
- exports.Deferred = Deferred;
598
- var VoidDeferred = /** @class */ (function (_super) {
599
- __extends(VoidDeferred, _super);
600
- function VoidDeferred() {
601
- return _super !== null && _super.apply(this, arguments) || this;
602
- }
603
- return VoidDeferred;
604
- }(Deferred));
605
- exports.VoidDeferred = VoidDeferred;
606
- //# sourceMappingURL=Deferred.js.map
607
525
 
608
- /***/ }),
609
526
 
610
- /***/ 47803:
611
- /***/ (function(__unused_webpack_module, exports) {
612
527
 
613
528
 
614
- var __assign = (this && this.__assign) || function () {
615
- __assign = Object.assign || function(t) {
616
- for (var s, i = 1, n = arguments.length; i < n; i++) {
617
- s = arguments[i];
618
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
619
- t[p] = s[p];
620
- }
621
- return t;
622
- };
623
- return __assign.apply(this, arguments);
624
- };
625
- Object.defineProperty(exports, "__esModule", ({ value: true }));
626
- exports.overwriteReadonlyProp = void 0;
627
- /**
628
- * Assign a value to a property even if the object is freezed or if the property is not writable
629
- * Throw if the assignation fail ( for example if the property is non configurable write: false )
630
- * */
631
- var overwriteReadonlyProp = function (obj, propertyName, value) {
632
- try {
633
- obj[propertyName] = value;
529
+
530
+
531
+
532
+
533
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
534
+ async function getIsPrettierAvailable() {
535
+ var _a;
536
+ if (getIsPrettierAvailable.cache !== undefined) {
537
+ return getIsPrettierAvailable.cache;
634
538
  }
635
- catch (_a) { }
636
- if (obj[propertyName] === value) {
637
- return value;
539
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({
540
+ packageJsonFilePath: undefined
541
+ });
542
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
543
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
544
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
545
+ getIsPrettierAvailable.cache = isPrettierAvailable;
546
+ return isPrettierAvailable;
547
+ }
548
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
549
+ async function getPrettier() {
550
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
551
+ if (getPrettier.cache !== undefined) {
552
+ return getPrettier.cache;
638
553
  }
639
- var errorDefineProperty = undefined;
640
- var propertyDescriptor = Object.getOwnPropertyDescriptor(obj, propertyName) || {
641
- "enumerable": true,
642
- "configurable": true,
643
- };
644
- if (!!propertyDescriptor.get) {
645
- throw new Error("Probably a wrong ides to overwrite ".concat(String(propertyName), " getter"));
554
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
555
+ import_prettier: {
556
+ // NOTE: When module is linked we want to make sure we import the correct version
557
+ // of prettier, that is the one of the project, not the one of this repo.
558
+ // So we do a sketchy eval to bypass ncc.
559
+ // We make sure to only do that when linking, otherwise we import properly.
560
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
561
+ 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"));
562
+ const isCJS = true && module.exports;
563
+ if (isCJS) {
564
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${prettierDirPath}")`);
565
+ }
566
+ else {
567
+ prettier = await new Promise(_resolve => {
568
+ eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_1__.join)(prettierDirPath, "index.mjs").replace(/\\/g, "/")}").then(prettier => _resolve(prettier))`);
569
+ });
570
+ }
571
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
572
+ break import_prettier;
573
+ }
574
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
646
575
  }
576
+ const configHash = await (async () => {
577
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", ".."));
578
+ if (configFilePath === null) {
579
+ return "";
580
+ }
581
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
582
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
583
+ })();
584
+ const prettierAndConfig = {
585
+ prettier,
586
+ configHash
587
+ };
588
+ getPrettier.cache = prettierAndConfig;
589
+ return prettierAndConfig;
590
+ }
591
+ async function runPrettier(params) {
592
+ const { sourceCode, filePath } = params;
593
+ let formattedSourceCode;
647
594
  try {
648
- Object.defineProperty(obj, propertyName, __assign(__assign({}, propertyDescriptor), { value: value }));
595
+ const { prettier } = await getPrettier();
596
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
597
+ resolveConfig: true
598
+ });
599
+ if (ignored || inferredParser === null) {
600
+ return sourceCode;
601
+ }
602
+ const config = await prettier.resolveConfig(filePath);
603
+ formattedSourceCode = await prettier.format(typeof sourceCode === "string" ? sourceCode : sourceCode.toString("utf8"), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
649
604
  }
650
605
  catch (error) {
651
- errorDefineProperty = error;
652
- }
653
- if (obj[propertyName] !== value) {
654
- throw errorDefineProperty || new Error("Can't assign");
606
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
607
+ throw error;
655
608
  }
656
- return value;
657
- };
658
- exports.overwriteReadonlyProp = overwriteReadonlyProp;
659
- //# sourceMappingURL=overwriteReadonlyProp.js.map
609
+ return typeof sourceCode === "string"
610
+ ? formattedSourceCode
611
+ : Buffer.from(formattedSourceCode, "utf8");
612
+ }
613
+ //# sourceMappingURL=runPrettier.js.map
660
614
 
661
615
  /***/ }),
662
616