keycloakify 11.6.1 → 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 (41) hide show
  1. package/bin/363.index.js +1528 -0
  2. package/bin/453.index.js +1 -1
  3. package/bin/735.index.js +1 -1
  4. package/bin/{615.index.js → 840.index.js} +9 -9
  5. package/bin/930.index.js +165 -0
  6. package/bin/946.index.js +20 -0
  7. package/bin/main.js +58 -16
  8. package/bin/{eject-file.d.ts → own.d.ts} +2 -1
  9. package/bin/shared/{addPostinstallScriptIfNotPresent.d.ts → addSyncExtensionsToPostinstallScript.d.ts} +1 -1
  10. package/bin/{postinstall/uiModuleMeta.d.ts → sync-extensions/extensionModuleMeta.d.ts} +5 -5
  11. package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
  12. package/bin/sync-extensions/index.d.ts +1 -0
  13. package/bin/{postinstall/installUiModulesPeerDependencies.d.ts → sync-extensions/installExtensionModulesPeerDependencies.d.ts} +3 -3
  14. package/bin/{postinstall → sync-extensions}/managedGitignoreFile.d.ts +4 -4
  15. package/bin/tools/isKnownByGit.d.ts +3 -0
  16. package/package.json +23 -23
  17. package/src/bin/eject-page.ts +1 -3
  18. package/src/bin/initialize-admin-theme.ts +2 -2
  19. package/src/bin/main.ts +61 -16
  20. package/src/bin/own.ts +209 -0
  21. package/src/bin/shared/{addPostinstallScriptIfNotPresent.ts → addSyncExtensionsToPostinstallScript.ts} +2 -2
  22. package/src/bin/{postinstall/uiModuleMeta.ts → sync-extensions/extensionModuleMeta.ts} +48 -42
  23. package/src/bin/{postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts → sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts} +32 -21
  24. package/src/bin/sync-extensions/index.ts +1 -0
  25. package/src/bin/{postinstall/installUiModulesPeerDependencies.ts → sync-extensions/installExtensionModulesPeerDependencies.ts} +15 -13
  26. package/src/bin/{postinstall → sync-extensions}/managedGitignoreFile.ts +18 -18
  27. package/src/bin/{postinstall/postinstall.ts → sync-extensions/sync-extension.ts} +14 -26
  28. package/src/bin/tools/isKnownByGit.ts +45 -0
  29. package/src/bin/tools/listInstalledModules.ts +2 -2
  30. package/src/bin/tools/npmInstall.ts +1 -1
  31. package/src/bin/tools/untrackFromGit.ts +19 -3
  32. package/bin/300.index.js +0 -770
  33. package/bin/653.index.js +0 -753
  34. package/bin/854.index.js +0 -68
  35. package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +0 -12
  36. package/bin/postinstall/index.d.ts +0 -1
  37. package/bin/tools/isTrackedByGit.d.ts +0 -3
  38. package/src/bin/eject-file.ts +0 -68
  39. package/src/bin/postinstall/index.ts +0 -1
  40. package/src/bin/tools/isTrackedByGit.ts +0 -29
  41. /package/bin/{postinstall/postinstall.d.ts → sync-extensions/sync-extension.d.ts} +0 -0
package/bin/653.index.js DELETED
@@ -1,753 +0,0 @@
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 + 3 modules
18
- var postinstall_uiModuleMeta = __webpack_require__(58644);
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
34
- 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
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
- await (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
- /***/ 12171:
254
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
255
-
256
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
257
- /* harmony export */ "h": () => (/* binding */ SemVer)
258
- /* harmony export */ });
259
- var SemVer;
260
- (function (SemVer) {
261
- const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
262
- function parse(versionStr) {
263
- const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
264
- if (!match) {
265
- throw new Error(`${versionStr} is not a valid semantic version`);
266
- }
267
- const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
268
- const str = match[3];
269
- return str === undefined ? 0 : parseInt(str);
270
- })() }, (() => {
271
- const str = match[4];
272
- return str === undefined ? {} : { rc: parseInt(str) };
273
- })());
274
- const initialStr = stringify(semVer);
275
- Object.defineProperty(semVer, "parsedFrom", {
276
- enumerable: true,
277
- get: function () {
278
- const currentStr = stringify(this);
279
- if (currentStr !== initialStr) {
280
- throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
281
- }
282
- return versionStr;
283
- }
284
- });
285
- return semVer;
286
- }
287
- SemVer.parse = parse;
288
- function stringify(v) {
289
- return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
290
- }
291
- SemVer.stringify = stringify;
292
- /**
293
- *
294
- * v1 < v2 => -1
295
- * v1 === v2 => 0
296
- * v1 > v2 => 1
297
- *
298
- */
299
- function compare(v1, v2) {
300
- const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
301
- const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
302
- for (const level of ["major", "minor", "patch", "rc"]) {
303
- if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
304
- return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
305
- }
306
- }
307
- return 0;
308
- }
309
- SemVer.compare = compare;
310
- /*
311
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
312
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
313
- console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
314
- */
315
- function bumpType(params) {
316
- const versionAhead = typeof params.versionAhead === "string"
317
- ? parse(params.versionAhead)
318
- : params.versionAhead;
319
- const versionBehind = typeof params.versionBehind === "string"
320
- ? parse(params.versionBehind)
321
- : params.versionBehind;
322
- if (compare(versionBehind, versionAhead) === 1) {
323
- throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
324
- }
325
- for (const level of ["major", "minor", "patch", "rc"]) {
326
- if (versionBehind[level] !== versionAhead[level]) {
327
- return level;
328
- }
329
- }
330
- return "no bump";
331
- }
332
- SemVer.bumpType = bumpType;
333
- })(SemVer || (SemVer = {}));
334
- //# sourceMappingURL=SemVer.js.map
335
-
336
- /***/ }),
337
-
338
- /***/ 89693:
339
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
340
-
341
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
342
- /* harmony export */ "a": () => (/* binding */ rmSync)
343
- /* harmony export */ });
344
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
345
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
346
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
347
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
348
- /* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
349
-
350
-
351
-
352
- /**
353
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
354
- * For older version of Node
355
- */
356
- function rmSync(dirPath, options) {
357
- 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) {
358
- fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
359
- return;
360
- }
361
- const { force = true } = options;
362
- if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
363
- return;
364
- }
365
- const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
366
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
367
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
368
- removeDir_rec(fileOrDirPath);
369
- return;
370
- }
371
- else {
372
- fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
373
- }
374
- });
375
- removeDir_rec(dirPath);
376
- }
377
- //# sourceMappingURL=fs.rmSync.js.map
378
-
379
- /***/ }),
380
-
381
- /***/ 50030:
382
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
383
-
384
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
385
- /* harmony export */ "c": () => (/* binding */ npmInstall)
386
- /* harmony export */ });
387
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
388
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
389
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
390
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
391
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(32081);
392
- /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_2__);
393
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78818);
394
- /* 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_8__ = __webpack_require__(52300);
396
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29041);
397
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(38469);
398
- /* harmony import */ var tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(23483);
399
- /* harmony import */ var _getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84794);
400
- /* harmony import */ var tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(83101);
401
- /* harmony import */ var _fs_rmSync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(89693);
402
- /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50689);
403
- /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__);
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
- async function npmInstall(params) {
417
- const { packageJsonDirPath } = params;
418
- const packageManagerBinName = (() => {
419
- const packageMangers = [
420
- {
421
- binName: "yarn",
422
- lockFileBasename: "yarn.lock"
423
- },
424
- {
425
- binName: "npm",
426
- lockFileBasename: "package-lock.json"
427
- },
428
- {
429
- binName: "pnpm",
430
- lockFileBasename: "pnpm-lock.yaml"
431
- },
432
- {
433
- binName: "bun",
434
- lockFileBasename: "bun.lockdb"
435
- },
436
- {
437
- binName: "deno",
438
- lockFileBasename: "deno.lock"
439
- }
440
- ];
441
- for (const packageManager of packageMangers) {
442
- if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
443
- fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(process.cwd(), packageManager.lockFileBasename))) {
444
- return packageManager.binName;
445
- }
446
- }
447
- throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
448
- })();
449
- console.log(`Installing the new dependencies...`);
450
- install_without_breaking_links: {
451
- if (packageManagerBinName !== "yarn") {
452
- break install_without_breaking_links;
453
- }
454
- const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
455
- if (garronejLinkInfos === undefined) {
456
- break install_without_breaking_links;
457
- }
458
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().green("Installing in a way that won't break the links..."));
459
- await installWithoutBreakingLinks({
460
- packageJsonDirPath,
461
- garronejLinkInfos
462
- });
463
- return;
464
- }
465
- try {
466
- await runPackageManagerInstall({
467
- packageManagerBinName,
468
- cwd: packageJsonDirPath
469
- });
470
- }
471
- catch (_a) {
472
- console.log(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
473
- }
474
- }
475
- async function runPackageManagerInstall(params) {
476
- const { packageManagerBinName, cwd } = params;
477
- const dCompleted = new evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_7__.Deferred();
478
- const child = child_process__WEBPACK_IMPORTED_MODULE_2__.spawn(packageManagerBinName, ["install"], {
479
- cwd,
480
- env: process.env,
481
- shell: true
482
- });
483
- child.stdout.on("data", data => process.stdout.write(data));
484
- child.stderr.on("data", data => {
485
- if (data.toString("utf8").includes("has unmet peer dependency")) {
486
- return;
487
- }
488
- process.stderr.write(data);
489
- });
490
- child.on("exit", code => {
491
- if (code !== 0) {
492
- dCompleted.reject(new Error(`Failed with code ${code}`));
493
- return;
494
- }
495
- dCompleted.resolve();
496
- });
497
- await dCompleted.pr;
498
- }
499
- function getGarronejLinkInfos(params) {
500
- const { packageJsonDirPath } = params;
501
- const nodeModuleDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, "node_modules");
502
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(nodeModuleDirPath)) {
503
- return undefined;
504
- }
505
- const linkedModuleNames = [];
506
- let yarnHomeDirPath = undefined;
507
- const getIsLinkedByGarronejScript = (path) => {
508
- let realPath;
509
- try {
510
- realPath = fs__WEBPACK_IMPORTED_MODULE_0__.readlinkSync(path);
511
- }
512
- catch (_a) {
513
- return false;
514
- }
515
- const doesIncludeYarnHome = realPath.includes(".yarn_home");
516
- if (!doesIncludeYarnHome) {
517
- return false;
518
- }
519
- set_yarnHomeDirPath: {
520
- if (yarnHomeDirPath !== undefined) {
521
- break set_yarnHomeDirPath;
522
- }
523
- const [firstElement] = (0,_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_5__/* .getAbsoluteAndInOsFormatPath */ .c)({
524
- pathIsh: realPath,
525
- cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(path)
526
- }).split(".yarn_home");
527
- yarnHomeDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(firstElement, ".yarn_home");
528
- }
529
- return true;
530
- };
531
- for (const basename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(nodeModuleDirPath)) {
532
- const path = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModuleDirPath, basename);
533
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(path).isSymbolicLink()) {
534
- if (basename.startsWith("@")) {
535
- return undefined;
536
- }
537
- if (!getIsLinkedByGarronejScript(path)) {
538
- return undefined;
539
- }
540
- linkedModuleNames.push(basename);
541
- continue;
542
- }
543
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(path).isDirectory()) {
544
- continue;
545
- }
546
- if (basename.startsWith("@")) {
547
- for (const subBasename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(path)) {
548
- const subPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(path, subBasename);
549
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(subPath).isSymbolicLink()) {
550
- continue;
551
- }
552
- if (!getIsLinkedByGarronejScript(subPath)) {
553
- return undefined;
554
- }
555
- linkedModuleNames.push(`${basename}/${subBasename}`);
556
- }
557
- }
558
- }
559
- if (yarnHomeDirPath === undefined) {
560
- return undefined;
561
- }
562
- return { linkedModuleNames, yarnHomeDirPath };
563
- }
564
- async function installWithoutBreakingLinks(params) {
565
- const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
566
- const parsedPackageJson = (() => {
567
- const packageJsonFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, "package.json");
568
- const zParsedPackageJson = (() => {
569
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_8__.z.object({
570
- scripts: zod__WEBPACK_IMPORTED_MODULE_8__.z.record(zod__WEBPACK_IMPORTED_MODULE_8__.z.string()).optional()
571
- });
572
- tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h;
573
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_9__.id)(zTargetType);
574
- })();
575
- const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString("utf8"));
576
- zParsedPackageJson.parse(parsedPackageJson);
577
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_4__.is)(parsedPackageJson));
578
- return parsedPackageJson;
579
- })();
580
- const isImplementedScriptByName = {
581
- postinstall: false,
582
- prepare: false
583
- };
584
- delete_postinstall_script: {
585
- if (parsedPackageJson.scripts === undefined) {
586
- break delete_postinstall_script;
587
- }
588
- for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
589
- if (parsedPackageJson.scripts[scriptName] === undefined) {
590
- continue;
591
- }
592
- isImplementedScriptByName[scriptName] = true;
593
- delete parsedPackageJson.scripts[scriptName];
594
- }
595
- }
596
- const tmpProjectDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(yarnHomeDirPath, "tmpProject");
597
- if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(tmpProjectDirPath)) {
598
- (0,_fs_rmSync__WEBPACK_IMPORTED_MODULE_6__/* .rmSync */ .a)(tmpProjectDirPath, { recursive: true });
599
- }
600
- fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(tmpProjectDirPath, { recursive: true });
601
- fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
602
- const YARN_LOCK = "yarn.lock";
603
- 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));
604
- await runPackageManagerInstall({
605
- packageManagerBinName: "yarn",
606
- cwd: tmpProjectDirPath
607
- });
608
- // NOTE: Moving the modules from the tmp project to the actual project
609
- // without messing up the links.
610
- {
611
- const { getAreSameVersions } = (() => {
612
- const zParsedPackageJson = (() => {
613
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_8__.z.object({
614
- version: zod__WEBPACK_IMPORTED_MODULE_8__.z.string()
615
- });
616
- tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h;
617
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_9__.id)(zTargetType);
618
- })();
619
- function readVersion(params) {
620
- const { moduleDirPath } = params;
621
- const packageJsonFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(moduleDirPath, "package.json");
622
- const packageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString("utf8"));
623
- zParsedPackageJson.parse(packageJson);
624
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_4__.is)(packageJson));
625
- return packageJson.version;
626
- }
627
- function getAreSameVersions(params) {
628
- const { moduleDirPath_a, moduleDirPath_b } = params;
629
- return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
630
- readVersion({ moduleDirPath: moduleDirPath_b }));
631
- }
632
- return { getAreSameVersions };
633
- })();
634
- const nodeModulesDirPath_tmpProject = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(tmpProjectDirPath, "node_modules");
635
- const nodeModulesDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(packageJsonDirPath, "node_modules");
636
- const modulePaths = fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(nodeModulesDirPath_tmpProject)
637
- .map(basename => {
638
- if (basename.startsWith(".")) {
639
- return undefined;
640
- }
641
- const path = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath_tmpProject, basename);
642
- if (basename.startsWith("@")) {
643
- return fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(path)
644
- .map(subBasename => {
645
- if (subBasename.startsWith(".")) {
646
- return undefined;
647
- }
648
- const subPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(path, subBasename);
649
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(subPath).isDirectory()) {
650
- return undefined;
651
- }
652
- return {
653
- moduleName: `${basename}/${subBasename}`,
654
- moduleDirPath_tmpProject: subPath,
655
- moduleDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath, basename, subBasename)
656
- };
657
- })
658
- .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__/* .exclude */ .D)(undefined));
659
- }
660
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(path).isDirectory()) {
661
- return undefined;
662
- }
663
- return [
664
- {
665
- moduleName: basename,
666
- moduleDirPath_tmpProject: path,
667
- moduleDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath, basename)
668
- }
669
- ];
670
- })
671
- .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_11__/* .exclude */ .D)(undefined))
672
- .flat();
673
- for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
674
- if (linkedModuleNames.includes(moduleName)) {
675
- continue;
676
- }
677
- let doesTargetModuleExist = false;
678
- skip_condition: {
679
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(moduleDirPath)) {
680
- break skip_condition;
681
- }
682
- doesTargetModuleExist = true;
683
- const areSameVersions = getAreSameVersions({
684
- moduleDirPath_a: moduleDirPath,
685
- moduleDirPath_b: moduleDirPath_tmpProject
686
- });
687
- if (!areSameVersions) {
688
- break skip_condition;
689
- }
690
- continue;
691
- }
692
- if (doesTargetModuleExist) {
693
- (0,_fs_rmSync__WEBPACK_IMPORTED_MODULE_6__/* .rmSync */ .a)(moduleDirPath, { recursive: true });
694
- }
695
- {
696
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(moduleDirPath);
697
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
698
- fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(dirPath, { recursive: true });
699
- }
700
- }
701
- fs__WEBPACK_IMPORTED_MODULE_0__.renameSync(moduleDirPath_tmpProject, moduleDirPath);
702
- }
703
- move_bin: {
704
- const binDirPath_tmpProject = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath_tmpProject, ".bin");
705
- const binDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesDirPath, ".bin");
706
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(binDirPath_tmpProject)) {
707
- break move_bin;
708
- }
709
- for (const basename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(binDirPath_tmpProject)) {
710
- const path_tmpProject = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(binDirPath_tmpProject, basename);
711
- const path = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(binDirPath, basename);
712
- if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path)) {
713
- continue;
714
- }
715
- fs__WEBPACK_IMPORTED_MODULE_0__.renameSync(path_tmpProject, path);
716
- }
717
- }
718
- }
719
- 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));
720
- (0,_fs_rmSync__WEBPACK_IMPORTED_MODULE_6__/* .rmSync */ .a)(tmpProjectDirPath, { recursive: true });
721
- for (const scriptName of (0,tsafe_objectKeys__WEBPACK_IMPORTED_MODULE_10__/* .objectKeys */ .Y)(isImplementedScriptByName)) {
722
- if (!isImplementedScriptByName[scriptName]) {
723
- continue;
724
- }
725
- child_process__WEBPACK_IMPORTED_MODULE_2__.execSync(`yarn run ${scriptName}`, {
726
- cwd: packageJsonDirPath,
727
- stdio: "inherit"
728
- });
729
- }
730
- }
731
- //# sourceMappingURL=npmInstall.js.map
732
-
733
- /***/ }),
734
-
735
- /***/ 23483:
736
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
737
-
738
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
739
- /* harmony export */ "Y": () => (/* binding */ objectKeys)
740
- /* harmony export */ });
741
- /** https://docs.tsafe.dev/objectKeys */
742
- function objectKeys(o) {
743
- return Object.keys(o);
744
- }
745
-
746
-
747
- //# sourceMappingURL=objectKeys.mjs.map
748
-
749
-
750
- /***/ })
751
-
752
- };
753
- ;