keycloakify 11.6.0 → 11.6.2

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 (49) hide show
  1. package/bin/{805.index.js → 174.index.js} +111 -2
  2. package/bin/363.index.js +1528 -0
  3. package/bin/453.index.js +1 -1
  4. package/bin/{33.index.js → 568.index.js} +2 -113
  5. package/bin/735.index.js +53 -24
  6. package/bin/{653.index.js → 840.index.js} +387 -213
  7. package/bin/921.index.js +1 -1
  8. package/bin/930.index.js +165 -0
  9. package/bin/946.index.js +20 -0
  10. package/bin/initialize-admin-theme.d.ts +4 -0
  11. package/bin/main.js +72 -18
  12. package/bin/{eject-file.d.ts → own.d.ts} +2 -1
  13. package/bin/shared/addSyncExtensionsToPostinstallScript.d.ts +10 -0
  14. package/bin/shared/customHandler.d.ts +1 -1
  15. package/bin/shared/customHandler.js.map +1 -1
  16. package/bin/{postinstall/uiModuleMeta.d.ts → sync-extensions/extensionModuleMeta.d.ts} +5 -5
  17. package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
  18. package/bin/sync-extensions/index.d.ts +1 -0
  19. package/bin/{postinstall/installUiModulesPeerDependencies.d.ts → sync-extensions/installExtensionModulesPeerDependencies.d.ts} +3 -3
  20. package/bin/{postinstall → sync-extensions}/managedGitignoreFile.d.ts +4 -4
  21. package/bin/tools/isKnownByGit.d.ts +3 -0
  22. package/bin/tools/npmInstall.d.ts +1 -1
  23. package/package.json +27 -22
  24. package/src/bin/eject-page.ts +1 -3
  25. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +3 -1
  26. package/src/bin/initialize-admin-theme.ts +146 -0
  27. package/src/bin/main.ts +76 -17
  28. package/src/bin/own.ts +209 -0
  29. package/src/bin/shared/addSyncExtensionsToPostinstallScript.ts +70 -0
  30. package/src/bin/shared/customHandler.ts +1 -0
  31. package/src/bin/{postinstall/uiModuleMeta.ts → sync-extensions/extensionModuleMeta.ts} +55 -43
  32. package/src/bin/{postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts → sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts} +32 -21
  33. package/src/bin/sync-extensions/index.ts +1 -0
  34. package/src/bin/{postinstall/installUiModulesPeerDependencies.ts → sync-extensions/installExtensionModulesPeerDependencies.ts} +16 -14
  35. package/src/bin/{postinstall → sync-extensions}/managedGitignoreFile.ts +18 -18
  36. package/src/bin/{postinstall/postinstall.ts → sync-extensions/sync-extension.ts} +14 -26
  37. package/src/bin/tools/isKnownByGit.ts +45 -0
  38. package/src/bin/tools/listInstalledModules.ts +2 -2
  39. package/src/bin/tools/npmInstall.ts +46 -9
  40. package/src/bin/tools/untrackFromGit.ts +19 -3
  41. package/bin/356.index.js +0 -755
  42. package/bin/854.index.js +0 -68
  43. package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +0 -12
  44. package/bin/postinstall/index.d.ts +0 -1
  45. package/bin/tools/isTrackedByGit.d.ts +0 -3
  46. package/src/bin/eject-file.ts +0 -68
  47. package/src/bin/postinstall/index.ts +0 -1
  48. package/src/bin/tools/isTrackedByGit.ts +0 -29
  49. /package/bin/{postinstall/postinstall.d.ts → sync-extensions/sync-extension.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- exports.id = 653;
3
- exports.ids = [653];
2
+ exports.id = 840;
3
+ exports.ids = [840];
4
4
  exports.modules = {
5
5
 
6
- /***/ 2653:
6
+ /***/ 48840:
7
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
8
 
9
9
  // ESM COMPAT FLAG
@@ -11,30 +11,72 @@ __webpack_require__.r(__webpack_exports__);
11
11
 
12
12
  // EXPORTS
13
13
  __webpack_require__.d(__webpack_exports__, {
14
- "command": () => (/* reexport */ command)
14
+ "command": () => (/* binding */ command)
15
15
  });
16
16
 
17
- // EXTERNAL MODULE: ./dist/bin/postinstall/uiModuleMeta.js + 2 modules
18
- var postinstall_uiModuleMeta = __webpack_require__(5038);
17
+ // EXTERNAL MODULE: external "path"
18
+ var external_path_ = __webpack_require__(71017);
19
+ // EXTERNAL MODULE: external "fs"
20
+ var external_fs_ = __webpack_require__(57147);
21
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
22
+ var customHandler_delegate = __webpack_require__(72138);
19
23
  // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
20
24
  var assert = __webpack_require__(29041);
21
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
22
- var lib = __webpack_require__(52300);
23
25
  // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
24
26
  var id = __webpack_require__(38469);
25
- // EXTERNAL MODULE: external "fs/promises"
26
- var promises_ = __webpack_require__(73292);
27
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
28
- var SemVer = __webpack_require__(12171);
29
- // EXTERNAL MODULE: ./node_modules/evt/tools/inDepth/same.js
30
- var same = __webpack_require__(33805);
27
+ ;// CONCATENATED MODULE: ./dist/bin/shared/addSyncExtensionsToPostinstallScript.js
28
+
29
+
30
+ (0,assert/* assert */.h)();
31
+ function addSyncExtensionsToPostinstallScript(params) {
32
+ var _a;
33
+ const { parsedPackageJson, buildContext } = params;
34
+ const cmd_base = "keycloakify sync-extensions";
35
+ const projectCliOptionValue = (() => {
36
+ const packageJsonDirPath = (0,external_path_.dirname)(buildContext.packageJsonFilePath);
37
+ const relativePath = (0,external_path_.relative)(packageJsonDirPath, buildContext.projectDirPath);
38
+ if (relativePath === "") {
39
+ return undefined;
40
+ }
41
+ return relativePath.split(external_path_.sep).join("/");
42
+ })();
43
+ const generateCmd = (params) => {
44
+ const { cmd_preexisting } = params;
45
+ let cmd = cmd_preexisting === undefined ? "" : `${cmd_preexisting} && `;
46
+ cmd += cmd_base;
47
+ if (projectCliOptionValue !== undefined) {
48
+ cmd += ` -p ${projectCliOptionValue}`;
49
+ }
50
+ return cmd;
51
+ };
52
+ {
53
+ const scripts = ((_a = parsedPackageJson.scripts) !== null && _a !== void 0 ? _a : (parsedPackageJson.scripts = {}));
54
+ for (const scriptName of ["postinstall", "prepare"]) {
55
+ const cmd_preexisting = scripts[scriptName];
56
+ if (cmd_preexisting === undefined) {
57
+ continue;
58
+ }
59
+ if (cmd_preexisting.includes(cmd_base)) {
60
+ scripts[scriptName] = generateCmd({ cmd_preexisting });
61
+ return;
62
+ }
63
+ }
64
+ }
65
+ parsedPackageJson.scripts = Object.assign({ postinstall: generateCmd({ cmd_preexisting: undefined }) }, parsedPackageJson.scripts);
66
+ }
67
+ //# sourceMappingURL=addSyncExtensionsToPostinstallScript.js.map
31
68
  // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
32
69
  var runPrettier = __webpack_require__(48433);
33
70
  // EXTERNAL MODULE: ./dist/bin/tools/npmInstall.js
34
71
  var npmInstall = __webpack_require__(50030);
35
- // EXTERNAL MODULE: external "path"
36
- var external_path_ = __webpack_require__(71017);
37
- ;// CONCATENATED MODULE: ./dist/bin/postinstall/installUiModulesPeerDependencies.js
72
+ // EXTERNAL MODULE: external "child_process"
73
+ var external_child_process_ = __webpack_require__(32081);
74
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
75
+ var lib = __webpack_require__(52300);
76
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
77
+ var source = __webpack_require__(78818);
78
+ var source_default = /*#__PURE__*/__webpack_require__.n(source);
79
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-admin-theme.js
38
80
 
39
81
 
40
82
 
@@ -44,209 +86,157 @@ var external_path_ = __webpack_require__(71017);
44
86
 
45
87
 
46
88
 
47
- (0,assert/* assert */.h)();
48
- (0,assert/* assert */.h)();
49
- async function installUiModulesPeerDependencies(params) {
50
- var _a, _b;
51
- const { buildContext, uiModuleMetas } = params;
52
- const { uiModulesPerDependencies } = (() => {
53
- const uiModulesPerDependencies = {};
54
- for (const { peerDependencies } of uiModuleMetas) {
55
- for (const [peerDependencyName, versionRange_candidate] of Object.entries(peerDependencies)) {
56
- const versionRange = (() => {
57
- const versionRange_current = uiModulesPerDependencies[peerDependencyName];
58
- if (versionRange_current === undefined) {
59
- return versionRange_candidate;
60
- }
61
- if (versionRange_current === "*") {
62
- return versionRange_candidate;
63
- }
64
- if (versionRange_candidate === "*") {
65
- return versionRange_current;
66
- }
67
- const { versionRange } = [
68
- versionRange_current,
69
- versionRange_candidate
70
- ]
71
- .map(versionRange => ({
72
- versionRange,
73
- semVer: SemVer/* SemVer.parse */.h.parse((() => {
74
- if (versionRange.startsWith("^") ||
75
- versionRange.startsWith("~")) {
76
- return versionRange.slice(1);
77
- }
78
- return versionRange;
79
- })())
80
- }))
81
- .sort((a, b) => SemVer/* SemVer.compare */.h.compare(b.semVer, a.semVer))[0];
82
- return versionRange;
83
- })();
84
- uiModulesPerDependencies[peerDependencyName] = versionRange;
85
- }
89
+
90
+
91
+ async function command(params) {
92
+ var _a;
93
+ const { buildContext } = params;
94
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
95
+ commandName: "initialize-admin-theme",
96
+ buildContext
97
+ });
98
+ if (hasBeenHandled) {
99
+ return;
100
+ }
101
+ {
102
+ const adminThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "admin");
103
+ if (external_fs_.existsSync(adminThemeSrcDirPath) &&
104
+ external_fs_.readdirSync(adminThemeSrcDirPath).length > 0) {
105
+ console.warn(source_default().red(`There is already a ${(0,external_path_.relative)(process.cwd(), adminThemeSrcDirPath)} directory in your project. Aborting.`));
106
+ process.exit(-1);
86
107
  }
87
- return { uiModulesPerDependencies };
88
- })();
89
- const parsedPackageJson = await (async () => {
108
+ }
109
+ const parsedPackageJson = (() => {
90
110
  const zParsedPackageJson = (() => {
91
- const zParsedPackageJson = lib.z.object({
92
- dependencies: lib.z.record(lib.z.string()).optional(),
93
- devDependencies: lib.z.record(lib.z.string()).optional()
111
+ const zTargetType = lib.z.object({
112
+ scripts: lib.z.record(lib.z.union([lib.z.string(), lib.z.undefined()])).optional(),
113
+ dependencies: lib.z.record(lib.z.union([lib.z.string(), lib.z.undefined()])).optional(),
114
+ devDependencies: lib.z.record(lib.z.union([lib.z.string(), lib.z.undefined()])).optional()
94
115
  });
95
- (0,assert/* assert */.h)();
96
- return (0,id.id)(zParsedPackageJson);
116
+ assert/* assert */.h;
117
+ return (0,id.id)(zTargetType);
97
118
  })();
98
- const parsedPackageJson = JSON.parse((await promises_.readFile(buildContext.packageJsonFilePath)).toString("utf8"));
119
+ const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
99
120
  zParsedPackageJson.parse(parsedPackageJson);
100
121
  (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
101
122
  return parsedPackageJson;
102
123
  })();
103
- const parsedPackageJson_before = JSON.parse(JSON.stringify(parsedPackageJson));
104
- for (const [moduleName, versionRange] of Object.entries(uiModulesPerDependencies)) {
105
- if (moduleName.startsWith("@types/")) {
106
- ((_a = parsedPackageJson.devDependencies) !== null && _a !== void 0 ? _a : (parsedPackageJson.devDependencies = {}))[moduleName] = versionRange;
107
- continue;
124
+ addSyncExtensionsToPostinstallScript({
125
+ parsedPackageJson,
126
+ buildContext
127
+ });
128
+ const uiSharedMajor = (() => {
129
+ const dependencies = Object.assign(Object.assign({}, parsedPackageJson.devDependencies), parsedPackageJson.dependencies);
130
+ const version = dependencies["@keycloakify/keycloak-ui-shared"];
131
+ if (version === undefined) {
132
+ return undefined;
108
133
  }
109
- if (parsedPackageJson.devDependencies !== undefined) {
110
- delete parsedPackageJson.devDependencies[moduleName];
134
+ const match = version.match(/^[^~]?(\d+)\./);
135
+ if (match === null) {
136
+ return undefined;
111
137
  }
112
- ((_b = parsedPackageJson.dependencies) !== null && _b !== void 0 ? _b : (parsedPackageJson.dependencies = {}))[moduleName] = versionRange;
113
- }
114
- if ((0,same.same)(parsedPackageJson, parsedPackageJson_before)) {
115
- return;
138
+ return match[1];
139
+ })();
140
+ const moduleName = "@keycloakify/keycloak-admin-ui";
141
+ const version = JSON.parse(external_child_process_.execSync(`npm show ${moduleName} versions --json`)
142
+ .toString("utf8")
143
+ .trim())
144
+ .reverse()
145
+ .filter(version => !version.includes("-"))
146
+ .find(version => uiSharedMajor === undefined ? true : version.startsWith(`${uiSharedMajor}.`));
147
+ (0,assert/* assert */.h)(version !== undefined);
148
+ ((_a = parsedPackageJson.dependencies) !== null && _a !== void 0 ? _a : (parsedPackageJson.dependencies = {}))[moduleName] = `~${version}`;
149
+ if (parsedPackageJson.devDependencies !== undefined) {
150
+ delete parsedPackageJson.devDependencies[moduleName];
116
151
  }
117
- let packageJsonContentStr = JSON.stringify(parsedPackageJson, null, 2);
118
- format: {
119
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.MT)())) {
120
- break format;
152
+ {
153
+ let sourceCode = JSON.stringify(parsedPackageJson, undefined, 2);
154
+ if (await (0,runPrettier/* getIsPrettierAvailable */.MT)()) {
155
+ sourceCode = await (0,runPrettier/* runPrettier */.eY)({
156
+ sourceCode,
157
+ filePath: buildContext.packageJsonFilePath
158
+ });
121
159
  }
122
- packageJsonContentStr = await (0,runPrettier/* runPrettier */.eY)({
123
- sourceCode: packageJsonContentStr,
124
- filePath: buildContext.packageJsonFilePath
125
- });
160
+ external_fs_.writeFileSync(buildContext.packageJsonFilePath, Buffer.from(sourceCode, "utf8"));
126
161
  }
127
- await promises_.writeFile(buildContext.packageJsonFilePath, packageJsonContentStr);
128
- (0,npmInstall/* npmInstall */.c)({
162
+ await (0,npmInstall/* npmInstall */.c)({
129
163
  packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
130
164
  });
131
- process.exit(0);
132
165
  }
133
- //# sourceMappingURL=installUiModulesPeerDependencies.js.map
134
- // EXTERNAL MODULE: ./dist/bin/postinstall/managedGitignoreFile.js
135
- var managedGitignoreFile = __webpack_require__(36843);
136
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
137
- var fs_existsAsync = __webpack_require__(43765);
138
- // EXTERNAL MODULE: external "child_process"
139
- var external_child_process_ = __webpack_require__(32081);
140
- // EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
141
- var Deferred = __webpack_require__(50689);
142
- ;// CONCATENATED MODULE: ./dist/bin/tools/isTrackedByGit.js
143
-
166
+ //# sourceMappingURL=initialize-admin-theme.js.map
144
167
 
168
+ /***/ }),
145
169
 
146
- function getIsTrackedByGit(params) {
147
- const { filePath } = params;
148
- const dIsTracked = new Deferred.Deferred();
149
- external_child_process_.exec(`git ls-files --error-unmatch ${(0,external_path_.basename)(filePath)}`, { cwd: (0,external_path_.dirname)(filePath) }, error => {
150
- if (error === null) {
151
- dIsTracked.resolve(true);
152
- return;
153
- }
154
- if (error.code === 1) {
155
- dIsTracked.resolve(false);
156
- return;
157
- }
158
- dIsTracked.reject(error);
159
- });
160
- return dIsTracked.pr;
161
- }
162
- //# sourceMappingURL=isTrackedByGit.js.map
163
- ;// CONCATENATED MODULE: ./dist/bin/tools/untrackFromGit.js
170
+ /***/ 72138:
171
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
164
172
 
165
173
 
174
+ // EXPORTS
175
+ __webpack_require__.d(__webpack_exports__, {
176
+ "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
177
+ });
166
178
 
167
- async function untrackFromGit(params) {
168
- const { filePath } = params;
169
- const dDone = new Deferred.Deferred();
170
- external_child_process_.exec(`git rm --cached ${(0,external_path_.basename)(filePath)}`, { cwd: (0,external_path_.dirname)(filePath) }, error => {
171
- if (error !== null) {
172
- dDone.reject(error);
173
- return;
174
- }
175
- dDone.resolve();
176
- });
177
- await dDone.pr;
179
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
180
+ var esm_assert = __webpack_require__(29041);
181
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
182
+ var constants = __webpack_require__(173);
183
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
184
+
185
+
186
+ const BIN_NAME = "_keycloakify-custom-handler";
187
+ const NOT_IMPLEMENTED_EXIT_CODE = 78;
188
+ function readParams(params) {
189
+ const { apiVersion } = params;
190
+ assert(apiVersion === "v1");
191
+ const commandName = (() => {
192
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
193
+ assert(envValue !== undefined);
194
+ return envValue;
195
+ })();
196
+ const buildContext = (() => {
197
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
198
+ assert(envValue !== undefined);
199
+ return JSON.parse(envValue);
200
+ })();
201
+ return { commandName, buildContext };
178
202
  }
179
- //# sourceMappingURL=untrackFromGit.js.map
180
- ;// CONCATENATED MODULE: ./dist/bin/postinstall/postinstall.js
181
-
182
-
183
-
203
+ //# sourceMappingURL=customHandler.js.map
204
+ // EXTERNAL MODULE: external "child_process"
205
+ var external_child_process_ = __webpack_require__(32081);
206
+ // EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
207
+ var tools_nodeModulesBinDirPath = __webpack_require__(73776);
208
+ // EXTERNAL MODULE: external "fs"
209
+ var external_fs_ = __webpack_require__(57147);
210
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
184
211
 
185
212
 
186
213
 
187
214
 
188
215
 
189
216
 
190
- async function command(params) {
191
- const { buildContext } = params;
192
- const uiModuleMetas = await (0,postinstall_uiModuleMeta/* getUiModuleMetas */.j)({ buildContext });
193
- await installUiModulesPeerDependencies({
194
- buildContext,
195
- uiModuleMetas
196
- });
197
- const { ejectedFilesRelativePaths } = await (0,managedGitignoreFile/* readManagedGitignoreFile */.w)({
198
- buildContext
199
- });
200
- await (0,managedGitignoreFile/* writeManagedGitignoreFile */.Y)({
201
- buildContext,
202
- ejectedFilesRelativePaths,
203
- uiModuleMetas
204
- });
205
- await Promise.all(uiModuleMetas
206
- .map(uiModuleMeta => Promise.all(uiModuleMeta.files.map(async ({ fileRelativePath, copyableFilePath, hash }) => {
207
- if (ejectedFilesRelativePaths.includes(fileRelativePath)) {
208
- return;
209
- }
210
- const destFilePath = (0,external_path_.join)(buildContext.themeSrcDirPath, fileRelativePath);
211
- const doesFileExist = await (0,fs_existsAsync/* existsAsync */.o)(destFilePath);
212
- skip_condition: {
213
- if (!doesFileExist) {
214
- break skip_condition;
215
- }
216
- const destFileHash = (0,postinstall_uiModuleMeta/* computeHash */.x)(await promises_.readFile(destFilePath));
217
- if (destFileHash !== hash) {
218
- break skip_condition;
219
- }
220
- return;
221
- }
222
- git_untrack: {
223
- if (!doesFileExist) {
224
- break git_untrack;
225
- }
226
- const isTracked = await getIsTrackedByGit({
227
- filePath: destFilePath
228
- });
229
- if (!isTracked) {
230
- break git_untrack;
231
- }
232
- await untrackFromGit({
233
- filePath: destFilePath
234
- });
235
- }
236
- {
237
- const dirName = (0,external_path_.dirname)(destFilePath);
238
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirName))) {
239
- await promises_.mkdir(dirName, { recursive: true });
240
- }
217
+ (0,esm_assert/* assert */.h)();
218
+ function maybeDelegateCommandToCustomHandler(params) {
219
+ const { commandName, buildContext } = params;
220
+ const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
221
+ if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
222
+ return { hasBeenHandled: false };
223
+ }
224
+ try {
225
+ external_child_process_.execSync(`npx ${BIN_NAME}`, {
226
+ stdio: "inherit",
227
+ 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) })
228
+ });
229
+ }
230
+ catch (error) {
231
+ const status = error.status;
232
+ if (status === NOT_IMPLEMENTED_EXIT_CODE) {
233
+ return { hasBeenHandled: false };
241
234
  }
242
- await promises_.copyFile(copyableFilePath, destFilePath);
243
- })))
244
- .flat());
235
+ process.exit(status);
236
+ }
237
+ return { hasBeenHandled: true };
245
238
  }
246
- //# sourceMappingURL=postinstall.js.map
247
- ;// CONCATENATED MODULE: ./dist/bin/postinstall/index.js
248
-
249
- //# sourceMappingURL=index.js.map
239
+ //# sourceMappingURL=customHandler_delegate.js.map
250
240
 
251
241
  /***/ }),
252
242
 
@@ -378,6 +368,44 @@ function rmSync(dirPath, options) {
378
368
 
379
369
  /***/ }),
380
370
 
371
+ /***/ 73776:
372
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
373
+
374
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
375
+ /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
376
+ /* harmony export */ });
377
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
378
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
379
+
380
+ let cache = undefined;
381
+ function getNodeModulesBinDirPath() {
382
+ if (cache !== undefined) {
383
+ return cache;
384
+ }
385
+ const binPath = process.argv[1];
386
+ const segments = [".bin"];
387
+ let foundNodeModules = false;
388
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
389
+ skip_segment: {
390
+ if (foundNodeModules) {
391
+ break skip_segment;
392
+ }
393
+ if (segment === "node_modules") {
394
+ foundNodeModules = true;
395
+ break skip_segment;
396
+ }
397
+ continue;
398
+ }
399
+ segments.unshift(segment);
400
+ }
401
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
402
+ cache = nodeModulesBinDirPath;
403
+ return nodeModulesBinDirPath;
404
+ }
405
+ //# sourceMappingURL=nodeModulesBinDirPath.js.map
406
+
407
+ /***/ }),
408
+
381
409
  /***/ 50030:
382
410
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
383
411
 
@@ -392,13 +420,16 @@ function rmSync(dirPath, options) {
392
420
  /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_2__);
393
421
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78818);
394
422
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_3__);
395
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(52300);
423
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(52300);
396
424
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29041);
397
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(38469);
398
- /* harmony import */ var tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23483);
425
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(38469);
426
+ /* harmony import */ var tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(23483);
399
427
  /* harmony import */ var _getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84794);
400
- /* harmony import */ var tsafe_exclude__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(83101);
428
+ /* harmony import */ var tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(83101);
401
429
  /* harmony import */ var _fs_rmSync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(89693);
430
+ /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50689);
431
+ /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__);
432
+
402
433
 
403
434
 
404
435
 
@@ -410,7 +441,7 @@ function rmSync(dirPath, options) {
410
441
 
411
442
 
412
443
 
413
- function npmInstall(params) {
444
+ async function npmInstall(params) {
414
445
  const { packageJsonDirPath } = params;
415
446
  const packageManagerBinName = (() => {
416
447
  const packageMangers = [
@@ -453,22 +484,46 @@ function npmInstall(params) {
453
484
  break install_without_breaking_links;
454
485
  }
455
486
  console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().green("Installing in a way that won't break the links..."));
456
- installWithoutBreakingLinks({
487
+ await installWithoutBreakingLinks({
457
488
  packageJsonDirPath,
458
489
  garronejLinkInfos
459
490
  });
460
491
  return;
461
492
  }
462
493
  try {
463
- child_process__WEBPACK_IMPORTED_MODULE_2__.execSync(`${packageManagerBinName} install`, {
464
- cwd: packageJsonDirPath,
465
- stdio: "inherit"
494
+ await runPackageManagerInstall({
495
+ packageManagerBinName,
496
+ cwd: packageJsonDirPath
466
497
  });
467
498
  }
468
499
  catch (_a) {
469
500
  console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
470
501
  }
471
502
  }
503
+ async function runPackageManagerInstall(params) {
504
+ const { packageManagerBinName, cwd } = params;
505
+ const dCompleted = new evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__.Deferred();
506
+ const child = child_process__WEBPACK_IMPORTED_MODULE_2__.spawn(packageManagerBinName, ["install"], {
507
+ cwd,
508
+ env: process.env,
509
+ shell: true
510
+ });
511
+ child.stdout.on("data", data => process.stdout.write(data));
512
+ child.stderr.on("data", data => {
513
+ if (data.toString("utf8").includes("peer dependency")) {
514
+ return;
515
+ }
516
+ process.stderr.write(data);
517
+ });
518
+ child.on("exit", code => {
519
+ if (code !== 0) {
520
+ dCompleted.reject(new Error(`Failed with code ${code}`));
521
+ return;
522
+ }
523
+ dCompleted.resolve();
524
+ });
525
+ await dCompleted.pr;
526
+ }
472
527
  function getGarronejLinkInfos(params) {
473
528
  const { packageJsonDirPath } = params;
474
529
  const nodeModuleDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, "node_modules");
@@ -534,16 +589,16 @@ function getGarronejLinkInfos(params) {
534
589
  }
535
590
  return { linkedModuleNames, yarnHomeDirPath };
536
591
  }
537
- function installWithoutBreakingLinks(params) {
592
+ async function installWithoutBreakingLinks(params) {
538
593
  const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
539
594
  const parsedPackageJson = (() => {
540
595
  const packageJsonFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, "package.json");
541
596
  const zParsedPackageJson = (() => {
542
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_7__.z.object({
543
- scripts: zod__WEBPACK_IMPORTED_MODULE_7__.z.record(zod__WEBPACK_IMPORTED_MODULE_7__.z.string()).optional()
597
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_8__.z.object({
598
+ scripts: zod__WEBPACK_IMPORTED_MODULE_8__.z.record(zod__WEBPACK_IMPORTED_MODULE_8__.z.string()).optional()
544
599
  });
545
600
  tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h;
546
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(zTargetType);
601
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_9__.id)(zTargetType);
547
602
  })();
548
603
  const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString("utf8"));
549
604
  zParsedPackageJson.parse(parsedPackageJson);
@@ -558,7 +613,7 @@ function installWithoutBreakingLinks(params) {
558
613
  if (parsedPackageJson.scripts === undefined) {
559
614
  break delete_postinstall_script;
560
615
  }
561
- for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_9__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
616
+ for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
562
617
  if (parsedPackageJson.scripts[scriptName] === undefined) {
563
618
  continue;
564
619
  }
@@ -574,20 +629,20 @@ function installWithoutBreakingLinks(params) {
574
629
  fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
575
630
  const YARN_LOCK = "yarn.lock";
576
631
  fs__WEBPACK_IMPORTED_MODULE_0__.copyFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, YARN_LOCK), (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(tmpProjectDirPath, YARN_LOCK));
577
- child_process__WEBPACK_IMPORTED_MODULE_2__.execSync(`yarn install`, {
578
- cwd: tmpProjectDirPath,
579
- stdio: "inherit"
632
+ await runPackageManagerInstall({
633
+ packageManagerBinName: "yarn",
634
+ cwd: tmpProjectDirPath
580
635
  });
581
636
  // NOTE: Moving the modules from the tmp project to the actual project
582
637
  // without messing up the links.
583
638
  {
584
639
  const { getAreSameVersions } = (() => {
585
640
  const zParsedPackageJson = (() => {
586
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_7__.z.object({
587
- version: zod__WEBPACK_IMPORTED_MODULE_7__.z.string()
641
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_8__.z.object({
642
+ version: zod__WEBPACK_IMPORTED_MODULE_8__.z.string()
588
643
  });
589
644
  tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h;
590
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(zTargetType);
645
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_9__.id)(zTargetType);
591
646
  })();
592
647
  function readVersion(params) {
593
648
  const { moduleDirPath } = params;
@@ -628,7 +683,7 @@ function installWithoutBreakingLinks(params) {
628
683
  moduleDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath, basename, subBasename)
629
684
  };
630
685
  })
631
- .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_10__/* .exclude */ .D)(undefined));
686
+ .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__/* .exclude */ .D)(undefined));
632
687
  }
633
688
  if (!fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(path).isDirectory()) {
634
689
  return undefined;
@@ -641,7 +696,7 @@ function installWithoutBreakingLinks(params) {
641
696
  }
642
697
  ];
643
698
  })
644
- .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_10__/* .exclude */ .D)(undefined))
699
+ .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__/* .exclude */ .D)(undefined))
645
700
  .flat();
646
701
  for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
647
702
  if (linkedModuleNames.includes(moduleName)) {
@@ -691,7 +746,7 @@ function installWithoutBreakingLinks(params) {
691
746
  }
692
747
  fs__WEBPACK_IMPORTED_MODULE_0__.cpSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(tmpProjectDirPath, YARN_LOCK), (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, YARN_LOCK));
693
748
  (0,_fs_rmSync__WEBPACK_IMPORTED_MODULE_6__/* .rmSync */ .a)(tmpProjectDirPath, { recursive: true });
694
- for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_9__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
749
+ for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
695
750
  if (!isImplementedScriptByName[scriptName]) {
696
751
  continue;
697
752
  }
@@ -705,6 +760,107 @@ function installWithoutBreakingLinks(params) {
705
760
 
706
761
  /***/ }),
707
762
 
763
+ /***/ 48433:
764
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
765
+
766
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
767
+ /* harmony export */ "LG": () => (/* binding */ getPrettier),
768
+ /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
769
+ /* harmony export */ "eY": () => (/* binding */ runPrettier)
770
+ /* harmony export */ });
771
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
772
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
773
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
774
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
775
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
776
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
777
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
778
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
779
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
780
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
781
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
782
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
783
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
794
+ async function getIsPrettierAvailable() {
795
+ var _a;
796
+ if (getIsPrettierAvailable.cache !== undefined) {
797
+ return getIsPrettierAvailable.cache;
798
+ }
799
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
800
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
801
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
802
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
803
+ getIsPrettierAvailable.cache = isPrettierAvailable;
804
+ return isPrettierAvailable;
805
+ }
806
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
807
+ async function getPrettier() {
808
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
809
+ if (getPrettier.cache !== undefined) {
810
+ return getPrettier.cache;
811
+ }
812
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
813
+ import_prettier: {
814
+ // NOTE: When module is linked we want to make sure we import the correct version
815
+ // of prettier, that is the one of the project, not the one of this repo.
816
+ // So we do a sketchy eval to bypass ncc.
817
+ // We make sure to only do that when linking, otherwise we import properly.
818
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
819
+ 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"))}")`);
820
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
821
+ break import_prettier;
822
+ }
823
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
824
+ }
825
+ const configHash = await (async () => {
826
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
827
+ if (configFilePath === null) {
828
+ return "";
829
+ }
830
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
831
+ return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
832
+ })();
833
+ const prettierAndConfig = {
834
+ prettier,
835
+ configHash
836
+ };
837
+ getPrettier.cache = prettierAndConfig;
838
+ return prettierAndConfig;
839
+ }
840
+ async function runPrettier(params) {
841
+ const { sourceCode, filePath } = params;
842
+ let formattedSourceCode;
843
+ try {
844
+ const { prettier } = await getPrettier();
845
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
846
+ resolveConfig: true
847
+ });
848
+ if (ignored || inferredParser === null) {
849
+ return sourceCode;
850
+ }
851
+ const config = await prettier.resolveConfig(filePath);
852
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
853
+ }
854
+ catch (error) {
855
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
856
+ throw error;
857
+ }
858
+ return formattedSourceCode;
859
+ }
860
+ //# sourceMappingURL=runPrettier.js.map
861
+
862
+ /***/ }),
863
+
708
864
  /***/ 50689:
709
865
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
710
866
 
@@ -829,6 +985,24 @@ function objectKeys(o) {
829
985
  //# sourceMappingURL=objectKeys.mjs.map
830
986
 
831
987
 
988
+ /***/ }),
989
+
990
+ /***/ 76030:
991
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
992
+
993
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
994
+ /* harmony export */ "r": () => (/* binding */ symToStr)
995
+ /* harmony export */ });
996
+ /** @see <https://docs.tsafe.dev/main/symtostr> */
997
+ function symToStr(wrap) {
998
+ // @ts-expect-error: We know better
999
+ return Object.keys(wrap)[0];
1000
+ }
1001
+
1002
+
1003
+ //# sourceMappingURL=symToStr.mjs.map
1004
+
1005
+
832
1006
  /***/ })
833
1007
 
834
1008
  };