keycloakify 11.4.0-rc.0 → 11.4.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 (94) hide show
  1. package/README.md +2 -0
  2. package/account/i18n/noJsx/getI18n.js +5 -7
  3. package/account/i18n/noJsx/getI18n.js.map +1 -1
  4. package/account/i18n/withJsx/useI18n.js +15 -4
  5. package/account/i18n/withJsx/useI18n.js.map +1 -1
  6. package/bin/20.index.js +0 -85
  7. package/bin/33.index.js +55 -212
  8. package/bin/356.index.js +106 -45
  9. package/bin/36.index.js +1 -2922
  10. package/bin/{526.index.js → 392.index.js} +107 -3
  11. package/bin/40.index.js +1 -86
  12. package/bin/453.index.js +85 -22
  13. package/bin/573.index.js +5 -86
  14. package/bin/653.index.js +752 -0
  15. package/bin/658.index.js +197 -0
  16. package/bin/735.index.js +343 -116
  17. package/bin/786.index.js +78 -14
  18. package/bin/805.index.js +15 -18
  19. package/bin/921.index.js +79 -18
  20. package/bin/97.index.js +64 -13
  21. package/bin/main.js +165 -86
  22. package/bin/shared/constants.d.ts +2 -0
  23. package/bin/shared/constants.js +3 -1
  24. package/bin/shared/constants.js.map +1 -1
  25. package/bin/start-keycloak/startViteDevServer.d.ts +8 -0
  26. package/bin/tools/crawlAsync.d.ts +1 -1
  27. package/bin/tools/isTrackedByGit.d.ts +3 -0
  28. package/bin/tools/runPrettier.d.ts +5 -5
  29. package/bin/tools/untrackFromGit.d.ts +3 -0
  30. package/lib/getKcClsx.js +1 -2
  31. package/lib/getKcClsx.js.map +1 -1
  32. package/login/KcContext/KcContext.d.ts +2 -2
  33. package/login/KcContext/kcContextMocks.d.ts +1 -1
  34. package/login/TemplateProps.d.ts +0 -1
  35. package/login/i18n/noJsx/getI18n.js +5 -7
  36. package/login/i18n/noJsx/getI18n.js.map +1 -1
  37. package/login/i18n/withJsx/useI18n.js +15 -4
  38. package/login/i18n/withJsx/useI18n.js.map +1 -1
  39. package/login/pages/LoginConfigTotp.js +1 -1
  40. package/login/pages/LoginConfigTotp.js.map +1 -1
  41. package/login/pages/LoginPasskeysConditionalAuthenticate.js +16 -18
  42. package/login/pages/LoginPasskeysConditionalAuthenticate.js.map +1 -1
  43. package/package.json +17 -7
  44. package/src/account/i18n/noJsx/getI18n.tsx +5 -7
  45. package/src/account/i18n/withJsx/useI18n.tsx +18 -4
  46. package/src/bin/eject-page.ts +28 -10
  47. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +3 -18
  48. package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +1 -2
  49. package/src/bin/keycloakify/generateFtl/generateFtl.ts +6 -1
  50. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +39 -0
  51. package/src/bin/keycloakify/generateResources/generateResources.ts +6 -2
  52. package/src/bin/main.ts +51 -4
  53. package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +30 -19
  54. package/src/bin/postinstall/installUiModulesPeerDependencies.ts +3 -3
  55. package/src/bin/postinstall/managedGitignoreFile.ts +4 -3
  56. package/src/bin/postinstall/postinstall.ts +24 -2
  57. package/src/bin/postinstall/uiModuleMeta.ts +14 -9
  58. package/src/bin/shared/buildContext.ts +1 -2
  59. package/src/bin/shared/constants.ts +4 -1
  60. package/src/bin/start-keycloak/myrealm-realm-25.json +21 -34
  61. package/src/bin/start-keycloak/myrealm-realm-26.json +32 -35
  62. package/src/bin/start-keycloak/start-keycloak.ts +94 -1
  63. package/src/bin/start-keycloak/startViteDevServer.ts +66 -0
  64. package/src/bin/tools/crawlAsync.ts +6 -6
  65. package/src/bin/tools/isTrackedByGit.ts +29 -0
  66. package/src/bin/tools/listInstalledModules.ts +1 -2
  67. package/src/bin/tools/npmInstall.ts +396 -1
  68. package/src/bin/tools/runPrettier.ts +63 -14
  69. package/src/bin/tools/untrackFromGit.ts +24 -0
  70. package/src/bin/tsconfig.json +1 -1
  71. package/src/bin/update-kc-gen.ts +17 -2
  72. package/src/lib/getKcClsx.ts +1 -2
  73. package/src/login/KcContext/KcContext.ts +2 -2
  74. package/src/login/KcContext/kcContextMocks.ts +1 -1
  75. package/src/login/TemplateProps.ts +0 -1
  76. package/src/login/i18n/noJsx/getI18n.tsx +5 -7
  77. package/src/login/i18n/withJsx/useI18n.tsx +18 -4
  78. package/src/login/pages/LoginConfigTotp.tsx +18 -20
  79. package/src/login/pages/LoginPasskeysConditionalAuthenticate.tsx +51 -52
  80. package/src/tools/StatefulObservable/StatefulObservable.ts +1 -2
  81. package/src/tools/deepAssign.ts +1 -2
  82. package/src/tools/extractLastParenthesisContent.ts +43 -0
  83. package/src/vite-plugin/vite-plugin.ts +67 -0
  84. package/stories/login/pages/Info.stories.tsx +3 -39
  85. package/tools/StatefulObservable/StatefulObservable.js +1 -2
  86. package/tools/StatefulObservable/StatefulObservable.js.map +1 -1
  87. package/tools/deepAssign.js +1 -2
  88. package/tools/deepAssign.js.map +1 -1
  89. package/tools/extractLastParenthesisContent.d.ts +6 -0
  90. package/tools/extractLastParenthesisContent.js +36 -0
  91. package/tools/extractLastParenthesisContent.js.map +1 -0
  92. package/vite-plugin/index.js +326 -186
  93. package/bin/124.index.js +0 -348
  94. package/stories/login/pages/LoginDeviceVerifyUserCode.stories.tsx +0 -18
@@ -0,0 +1,752 @@
1
+ "use strict";
2
+ exports.id = 653;
3
+ exports.ids = [653];
4
+ exports.modules = {
5
+
6
+ /***/ 2653:
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: ./dist/bin/postinstall/uiModuleMeta.js + 2 modules
18
+ var postinstall_uiModuleMeta = __webpack_require__(5038);
19
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
20
+ var assert = __webpack_require__(29041);
21
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
22
+ var lib = __webpack_require__(52300);
23
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
24
+ 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);
31
+ // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
32
+ var runPrettier = __webpack_require__(48433);
33
+ // EXTERNAL MODULE: ./dist/bin/tools/npmInstall.js + 1 modules
34
+ var npmInstall = __webpack_require__(63046);
35
+ // EXTERNAL MODULE: external "path"
36
+ var external_path_ = __webpack_require__(71017);
37
+ ;// CONCATENATED MODULE: ./dist/bin/postinstall/installUiModulesPeerDependencies.js
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
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
+ }
86
+ }
87
+ return { uiModulesPerDependencies };
88
+ })();
89
+ const parsedPackageJson = await (async () => {
90
+ 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()
94
+ });
95
+ (0,assert/* assert */.h)();
96
+ return (0,id.id)(zParsedPackageJson);
97
+ })();
98
+ const parsedPackageJson = JSON.parse((await promises_.readFile(buildContext.packageJsonFilePath)).toString("utf8"));
99
+ zParsedPackageJson.parse(parsedPackageJson);
100
+ (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
101
+ return parsedPackageJson;
102
+ })();
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;
108
+ }
109
+ if (parsedPackageJson.devDependencies !== undefined) {
110
+ delete parsedPackageJson.devDependencies[moduleName];
111
+ }
112
+ ((_b = parsedPackageJson.dependencies) !== null && _b !== void 0 ? _b : (parsedPackageJson.dependencies = {}))[moduleName] = versionRange;
113
+ }
114
+ if ((0,same.same)(parsedPackageJson, parsedPackageJson_before)) {
115
+ return;
116
+ }
117
+ let packageJsonContentStr = JSON.stringify(parsedPackageJson, null, 2);
118
+ format: {
119
+ if (!(await (0,runPrettier/* getIsPrettierAvailable */.MT)())) {
120
+ break format;
121
+ }
122
+ packageJsonContentStr = await (0,runPrettier/* runPrettier */.eY)({
123
+ sourceCode: packageJsonContentStr,
124
+ filePath: buildContext.packageJsonFilePath
125
+ });
126
+ }
127
+ await promises_.writeFile(buildContext.packageJsonFilePath, packageJsonContentStr);
128
+ (0,npmInstall/* npmInstall */.c)({
129
+ packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
130
+ });
131
+ process.exit(0);
132
+ }
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
+
144
+
145
+
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
164
+
165
+
166
+
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;
178
+ }
179
+ //# sourceMappingURL=untrackFromGit.js.map
180
+ ;// CONCATENATED MODULE: ./dist/bin/postinstall/postinstall.js
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
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
+ }
241
+ }
242
+ await promises_.copyFile(copyableFilePath, destFilePath);
243
+ })))
244
+ .flat());
245
+ }
246
+ //# sourceMappingURL=postinstall.js.map
247
+ ;// CONCATENATED MODULE: ./dist/bin/postinstall/index.js
248
+
249
+ //# sourceMappingURL=index.js.map
250
+
251
+ /***/ }),
252
+
253
+ /***/ 89693:
254
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
255
+
256
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
257
+ /* harmony export */ "a": () => (/* binding */ rmSync)
258
+ /* harmony export */ });
259
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
260
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
261
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
262
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
263
+ /* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
264
+
265
+
266
+
267
+ /**
268
+ * Polyfill of fs.rmSync(dirPath, { "recursive": true })
269
+ * For older version of Node
270
+ */
271
+ function rmSync(dirPath, options) {
272
+ if (_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.compare */ .h.compare(_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse(process.version), _SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse("14.14.0")) > 0) {
273
+ fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
274
+ return;
275
+ }
276
+ const { force = true } = options;
277
+ if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
278
+ return;
279
+ }
280
+ const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
281
+ const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
282
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
283
+ removeDir_rec(fileOrDirPath);
284
+ return;
285
+ }
286
+ else {
287
+ fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
288
+ }
289
+ });
290
+ removeDir_rec(dirPath);
291
+ }
292
+ //# sourceMappingURL=fs.rmSync.js.map
293
+
294
+ /***/ }),
295
+
296
+ /***/ 63046:
297
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
298
+
299
+
300
+ // EXPORTS
301
+ __webpack_require__.d(__webpack_exports__, {
302
+ "c": () => (/* binding */ npmInstall)
303
+ });
304
+
305
+ // EXTERNAL MODULE: external "fs"
306
+ var external_fs_ = __webpack_require__(57147);
307
+ // EXTERNAL MODULE: external "path"
308
+ var external_path_ = __webpack_require__(71017);
309
+ // EXTERNAL MODULE: external "child_process"
310
+ var external_child_process_ = __webpack_require__(32081);
311
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
312
+ var source = __webpack_require__(78818);
313
+ var source_default = /*#__PURE__*/__webpack_require__.n(source);
314
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
315
+ var lib = __webpack_require__(52300);
316
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
317
+ var assert = __webpack_require__(29041);
318
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
319
+ var id = __webpack_require__(38469);
320
+ ;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
321
+ /** https://docs.tsafe.dev/objectKeys */
322
+ function objectKeys(o) {
323
+ return Object.keys(o);
324
+ }
325
+
326
+
327
+ //# sourceMappingURL=objectKeys.mjs.map
328
+
329
+ // EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
330
+ var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
331
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
332
+ var exclude = __webpack_require__(83101);
333
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
334
+ var fs_rmSync = __webpack_require__(89693);
335
+ ;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+ function npmInstall(params) {
348
+ const { packageJsonDirPath } = params;
349
+ const packageManagerBinName = (() => {
350
+ const packageMangers = [
351
+ {
352
+ binName: "yarn",
353
+ lockFileBasename: "yarn.lock"
354
+ },
355
+ {
356
+ binName: "npm",
357
+ lockFileBasename: "package-lock.json"
358
+ },
359
+ {
360
+ binName: "pnpm",
361
+ lockFileBasename: "pnpm-lock.yaml"
362
+ },
363
+ {
364
+ binName: "bun",
365
+ lockFileBasename: "bun.lockdb"
366
+ },
367
+ {
368
+ binName: "deno",
369
+ lockFileBasename: "deno.lock"
370
+ }
371
+ ];
372
+ for (const packageManager of packageMangers) {
373
+ if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
374
+ external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
375
+ return packageManager.binName;
376
+ }
377
+ }
378
+ throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
379
+ })();
380
+ console.log(`Installing the new dependencies...`);
381
+ install_without_breaking_links: {
382
+ if (packageManagerBinName !== "yarn") {
383
+ break install_without_breaking_links;
384
+ }
385
+ const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
386
+ if (garronejLinkInfos === undefined) {
387
+ break install_without_breaking_links;
388
+ }
389
+ console.log(source_default().green("Installing in a way that won't break the links..."));
390
+ installWithoutBreakingLinks({
391
+ packageJsonDirPath,
392
+ garronejLinkInfos
393
+ });
394
+ return;
395
+ }
396
+ try {
397
+ external_child_process_.execSync(`${packageManagerBinName} install`, {
398
+ cwd: packageJsonDirPath,
399
+ stdio: "inherit"
400
+ });
401
+ }
402
+ catch (_a) {
403
+ console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
404
+ }
405
+ }
406
+ function getGarronejLinkInfos(params) {
407
+ const { packageJsonDirPath } = params;
408
+ const nodeModuleDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
409
+ if (!external_fs_.existsSync(nodeModuleDirPath)) {
410
+ return undefined;
411
+ }
412
+ const linkedModuleNames = [];
413
+ let yarnHomeDirPath = undefined;
414
+ const getIsLinkedByGarronejScript = (path) => {
415
+ let realPath;
416
+ try {
417
+ realPath = external_fs_.readlinkSync(path);
418
+ }
419
+ catch (_a) {
420
+ return false;
421
+ }
422
+ const doesIncludeYarnHome = realPath.includes(".yarn_home");
423
+ if (!doesIncludeYarnHome) {
424
+ return false;
425
+ }
426
+ set_yarnHomeDirPath: {
427
+ if (yarnHomeDirPath !== undefined) {
428
+ break set_yarnHomeDirPath;
429
+ }
430
+ const [firstElement] = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
431
+ pathIsh: realPath,
432
+ cwd: (0,external_path_.dirname)(path)
433
+ }).split(".yarn_home");
434
+ yarnHomeDirPath = (0,external_path_.join)(firstElement, ".yarn_home");
435
+ }
436
+ return true;
437
+ };
438
+ for (const basename of external_fs_.readdirSync(nodeModuleDirPath)) {
439
+ const path = (0,external_path_.join)(nodeModuleDirPath, basename);
440
+ if (external_fs_.lstatSync(path).isSymbolicLink()) {
441
+ if (basename.startsWith("@")) {
442
+ return undefined;
443
+ }
444
+ if (!getIsLinkedByGarronejScript(path)) {
445
+ return undefined;
446
+ }
447
+ linkedModuleNames.push(basename);
448
+ continue;
449
+ }
450
+ if (!external_fs_.lstatSync(path).isDirectory()) {
451
+ continue;
452
+ }
453
+ if (basename.startsWith("@")) {
454
+ for (const subBasename of external_fs_.readdirSync(path)) {
455
+ const subPath = (0,external_path_.join)(path, subBasename);
456
+ if (!external_fs_.lstatSync(subPath).isSymbolicLink()) {
457
+ continue;
458
+ }
459
+ if (!getIsLinkedByGarronejScript(subPath)) {
460
+ return undefined;
461
+ }
462
+ linkedModuleNames.push(`${basename}/${subBasename}`);
463
+ }
464
+ }
465
+ }
466
+ if (yarnHomeDirPath === undefined) {
467
+ return undefined;
468
+ }
469
+ return { linkedModuleNames, yarnHomeDirPath };
470
+ }
471
+ function installWithoutBreakingLinks(params) {
472
+ const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
473
+ const parsedPackageJson = (() => {
474
+ const packageJsonFilePath = (0,external_path_.join)(packageJsonDirPath, "package.json");
475
+ const zParsedPackageJson = (() => {
476
+ const zTargetType = lib.z.object({
477
+ scripts: lib.z.record(lib.z.string()).optional()
478
+ });
479
+ assert/* assert */.h;
480
+ return (0,id.id)(zTargetType);
481
+ })();
482
+ const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
483
+ zParsedPackageJson.parse(parsedPackageJson);
484
+ (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
485
+ return parsedPackageJson;
486
+ })();
487
+ const isImplementedScriptByName = {
488
+ postinstall: false,
489
+ prepare: false
490
+ };
491
+ delete_postinstall_script: {
492
+ if (parsedPackageJson.scripts === undefined) {
493
+ break delete_postinstall_script;
494
+ }
495
+ for (const scriptName of objectKeys(isImplementedScriptByName)) {
496
+ if (parsedPackageJson.scripts[scriptName] === undefined) {
497
+ continue;
498
+ }
499
+ isImplementedScriptByName[scriptName] = true;
500
+ delete parsedPackageJson.scripts[scriptName];
501
+ }
502
+ }
503
+ const tmpProjectDirPath = (0,external_path_.join)(yarnHomeDirPath, "tmpProject");
504
+ if (external_fs_.existsSync(tmpProjectDirPath)) {
505
+ (0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
506
+ }
507
+ external_fs_.mkdirSync(tmpProjectDirPath, { recursive: true });
508
+ external_fs_.writeFileSync((0,external_path_.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
509
+ const YARN_LOCK = "yarn.lock";
510
+ external_fs_.copyFileSync((0,external_path_.join)(packageJsonDirPath, YARN_LOCK), (0,external_path_.join)(tmpProjectDirPath, YARN_LOCK));
511
+ external_child_process_.execSync(`yarn install`, {
512
+ cwd: tmpProjectDirPath,
513
+ stdio: "inherit"
514
+ });
515
+ // NOTE: Moving the modules from the tmp project to the actual project
516
+ // without messing up the links.
517
+ {
518
+ const { getAreSameVersions } = (() => {
519
+ const zParsedPackageJson = (() => {
520
+ const zTargetType = lib.z.object({
521
+ version: lib.z.string()
522
+ });
523
+ assert/* assert */.h;
524
+ return (0,id.id)(zTargetType);
525
+ })();
526
+ function readVersion(params) {
527
+ const { moduleDirPath } = params;
528
+ const packageJsonFilePath = (0,external_path_.join)(moduleDirPath, "package.json");
529
+ const packageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
530
+ zParsedPackageJson.parse(packageJson);
531
+ (0,assert/* assert */.h)((0,assert.is)(packageJson));
532
+ return packageJson.version;
533
+ }
534
+ function getAreSameVersions(params) {
535
+ const { moduleDirPath_a, moduleDirPath_b } = params;
536
+ return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
537
+ readVersion({ moduleDirPath: moduleDirPath_b }));
538
+ }
539
+ return { getAreSameVersions };
540
+ })();
541
+ const nodeModulesDirPath_tmpProject = (0,external_path_.join)(tmpProjectDirPath, "node_modules");
542
+ const nodeModulesDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
543
+ const modulePaths = external_fs_.readdirSync(nodeModulesDirPath_tmpProject)
544
+ .map(basename => {
545
+ if (basename.startsWith(".")) {
546
+ return undefined;
547
+ }
548
+ const path = (0,external_path_.join)(nodeModulesDirPath_tmpProject, basename);
549
+ if (basename.startsWith("@")) {
550
+ return external_fs_.readdirSync(path)
551
+ .map(subBasename => {
552
+ if (subBasename.startsWith(".")) {
553
+ return undefined;
554
+ }
555
+ const subPath = (0,external_path_.join)(path, subBasename);
556
+ if (!external_fs_.lstatSync(subPath).isDirectory()) {
557
+ return undefined;
558
+ }
559
+ return {
560
+ moduleName: `${basename}/${subBasename}`,
561
+ moduleDirPath_tmpProject: subPath,
562
+ moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename, subBasename)
563
+ };
564
+ })
565
+ .filter((0,exclude/* exclude */.D)(undefined));
566
+ }
567
+ if (!external_fs_.lstatSync(path).isDirectory()) {
568
+ return undefined;
569
+ }
570
+ return [
571
+ {
572
+ moduleName: basename,
573
+ moduleDirPath_tmpProject: path,
574
+ moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename)
575
+ }
576
+ ];
577
+ })
578
+ .filter((0,exclude/* exclude */.D)(undefined))
579
+ .flat();
580
+ for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
581
+ if (linkedModuleNames.includes(moduleName)) {
582
+ continue;
583
+ }
584
+ let doesTargetModuleExist = false;
585
+ skip_condition: {
586
+ if (!external_fs_.existsSync(moduleDirPath)) {
587
+ break skip_condition;
588
+ }
589
+ doesTargetModuleExist = true;
590
+ const areSameVersions = getAreSameVersions({
591
+ moduleDirPath_a: moduleDirPath,
592
+ moduleDirPath_b: moduleDirPath_tmpProject
593
+ });
594
+ if (!areSameVersions) {
595
+ break skip_condition;
596
+ }
597
+ continue;
598
+ }
599
+ if (doesTargetModuleExist) {
600
+ (0,fs_rmSync/* rmSync */.a)(moduleDirPath, { recursive: true });
601
+ }
602
+ {
603
+ const dirPath = (0,external_path_.dirname)(moduleDirPath);
604
+ if (!external_fs_.existsSync(dirPath)) {
605
+ external_fs_.mkdirSync(dirPath, { recursive: true });
606
+ }
607
+ }
608
+ external_fs_.renameSync(moduleDirPath_tmpProject, moduleDirPath);
609
+ }
610
+ move_bin: {
611
+ const binDirPath_tmpProject = (0,external_path_.join)(nodeModulesDirPath_tmpProject, ".bin");
612
+ const binDirPath = (0,external_path_.join)(nodeModulesDirPath, ".bin");
613
+ if (!external_fs_.existsSync(binDirPath_tmpProject)) {
614
+ break move_bin;
615
+ }
616
+ for (const basename of external_fs_.readdirSync(binDirPath_tmpProject)) {
617
+ const path_tmpProject = (0,external_path_.join)(binDirPath_tmpProject, basename);
618
+ const path = (0,external_path_.join)(binDirPath, basename);
619
+ if (external_fs_.existsSync(path)) {
620
+ continue;
621
+ }
622
+ external_fs_.renameSync(path_tmpProject, path);
623
+ }
624
+ }
625
+ }
626
+ external_fs_.cpSync((0,external_path_.join)(tmpProjectDirPath, YARN_LOCK), (0,external_path_.join)(packageJsonDirPath, YARN_LOCK));
627
+ (0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
628
+ for (const scriptName of objectKeys(isImplementedScriptByName)) {
629
+ if (!isImplementedScriptByName[scriptName]) {
630
+ continue;
631
+ }
632
+ external_child_process_.execSync(`yarn run ${scriptName}`, {
633
+ cwd: packageJsonDirPath,
634
+ stdio: "inherit"
635
+ });
636
+ }
637
+ }
638
+ //# sourceMappingURL=npmInstall.js.map
639
+
640
+ /***/ }),
641
+
642
+ /***/ 50689:
643
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
644
+
645
+
646
+ var __extends = (this && this.__extends) || (function () {
647
+ var extendStatics = function (d, b) {
648
+ extendStatics = Object.setPrototypeOf ||
649
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
650
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
651
+ return extendStatics(d, b);
652
+ };
653
+ return function (d, b) {
654
+ if (typeof b !== "function" && b !== null)
655
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
656
+ extendStatics(d, b);
657
+ function __() { this.constructor = d; }
658
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
659
+ };
660
+ })();
661
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
662
+ exports.VoidDeferred = exports.Deferred = void 0;
663
+ var overwriteReadonlyProp_1 = __webpack_require__(47803);
664
+ var Deferred = /** @class */ (function () {
665
+ function Deferred() {
666
+ var _this_1 = this;
667
+ this.isPending = true;
668
+ var resolve;
669
+ var reject;
670
+ this.pr = new Promise(function (resolve_, reject_) {
671
+ resolve = function (value) {
672
+ (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
673
+ resolve_(value);
674
+ };
675
+ reject = function (error) {
676
+ (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
677
+ reject_(error);
678
+ };
679
+ });
680
+ this.resolve = resolve;
681
+ this.reject = reject;
682
+ }
683
+ return Deferred;
684
+ }());
685
+ exports.Deferred = Deferred;
686
+ var VoidDeferred = /** @class */ (function (_super) {
687
+ __extends(VoidDeferred, _super);
688
+ function VoidDeferred() {
689
+ return _super !== null && _super.apply(this, arguments) || this;
690
+ }
691
+ return VoidDeferred;
692
+ }(Deferred));
693
+ exports.VoidDeferred = VoidDeferred;
694
+ //# sourceMappingURL=Deferred.js.map
695
+
696
+ /***/ }),
697
+
698
+ /***/ 47803:
699
+ /***/ (function(__unused_webpack_module, exports) {
700
+
701
+
702
+ var __assign = (this && this.__assign) || function () {
703
+ __assign = Object.assign || function(t) {
704
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
705
+ s = arguments[i];
706
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
707
+ t[p] = s[p];
708
+ }
709
+ return t;
710
+ };
711
+ return __assign.apply(this, arguments);
712
+ };
713
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
714
+ exports.overwriteReadonlyProp = void 0;
715
+ /**
716
+ * Assign a value to a property even if the object is freezed or if the property is not writable
717
+ * Throw if the assignation fail ( for example if the property is non configurable write: false )
718
+ * */
719
+ var overwriteReadonlyProp = function (obj, propertyName, value) {
720
+ try {
721
+ obj[propertyName] = value;
722
+ }
723
+ catch (_a) { }
724
+ if (obj[propertyName] === value) {
725
+ return value;
726
+ }
727
+ var errorDefineProperty = undefined;
728
+ var propertyDescriptor = Object.getOwnPropertyDescriptor(obj, propertyName) || {
729
+ "enumerable": true,
730
+ "configurable": true,
731
+ };
732
+ if (!!propertyDescriptor.get) {
733
+ throw new Error("Probably a wrong ides to overwrite ".concat(String(propertyName), " getter"));
734
+ }
735
+ try {
736
+ Object.defineProperty(obj, propertyName, __assign(__assign({}, propertyDescriptor), { value: value }));
737
+ }
738
+ catch (error) {
739
+ errorDefineProperty = error;
740
+ }
741
+ if (obj[propertyName] !== value) {
742
+ throw errorDefineProperty || new Error("Can't assign");
743
+ }
744
+ return value;
745
+ };
746
+ exports.overwriteReadonlyProp = overwriteReadonlyProp;
747
+ //# sourceMappingURL=overwriteReadonlyProp.js.map
748
+
749
+ /***/ })
750
+
751
+ };
752
+ ;