keycloakify 11.8.30 → 11.8.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/363.index.js DELETED
@@ -1,1676 +0,0 @@
1
- "use strict";
2
- exports.id = 363;
3
- exports.ids = [363];
4
- exports.modules = {
5
-
6
- /***/ 77372:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "x": () => (/* binding */ computeHash),
13
- "f": () => (/* binding */ getExtensionModuleMetas)
14
- });
15
-
16
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
17
- var assert = __webpack_require__(29041);
18
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
19
- var id = __webpack_require__(38469);
20
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
21
- var lib = __webpack_require__(52300);
22
- // EXTERNAL MODULE: external "path"
23
- var external_path_ = __webpack_require__(71017);
24
- // EXTERNAL MODULE: external "fs/promises"
25
- var promises_ = __webpack_require__(73292);
26
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
27
- var fs_existsAsync = __webpack_require__(43765);
28
- // EXTERNAL MODULE: ./dist/bin/tools/listInstalledModules.js
29
- var listInstalledModules = __webpack_require__(75564);
30
- ;// CONCATENATED MODULE: ./dist/bin/tools/crawlAsync.js
31
-
32
-
33
-
34
- /** List all files in a given directory return paths relative to the dir_path */
35
- async function crawlAsync(params) {
36
- const { dirPath, returnedPathsType, onFileFound } = params;
37
- await crawlAsyncRec({
38
- dirPath,
39
- onFileFound: async ({ filePath }) => {
40
- switch (returnedPathsType) {
41
- case "absolute":
42
- await onFileFound(filePath);
43
- return;
44
- case "relative to dirPath":
45
- await onFileFound((0,external_path_.relative)(dirPath, filePath));
46
- return;
47
- }
48
- (0,assert/* assert */.h)();
49
- }
50
- });
51
- }
52
- async function crawlAsyncRec(params) {
53
- const { dirPath, onFileFound } = params;
54
- await Promise.all((await promises_.readdir(dirPath)).map(async (basename) => {
55
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
56
- const isDirectory = await promises_.lstat(fileOrDirPath)
57
- .then(stat => stat.isDirectory());
58
- if (isDirectory) {
59
- await crawlAsyncRec({ dirPath: fileOrDirPath, onFileFound });
60
- return;
61
- }
62
- await onFileFound({ filePath: fileOrDirPath });
63
- }));
64
- }
65
- //# sourceMappingURL=crawlAsync.js.map
66
- // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
67
- var runPrettier = __webpack_require__(48433);
68
- // EXTERNAL MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
69
- var readThisNpmPackageVersion = __webpack_require__(64795);
70
- // EXTERNAL MODULE: ./dist/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.js
71
- var getExtensionModuleFileSourceCodeReadyToBeCopied = __webpack_require__(2237);
72
- // EXTERNAL MODULE: external "crypto"
73
- var external_crypto_ = __webpack_require__(6113);
74
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
75
- var constants = __webpack_require__(173);
76
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
77
- var exclude = __webpack_require__(83101);
78
- ;// CONCATENATED MODULE: ./node_modules/tsafe/esm/isAmong.mjs
79
- /** https://docs.tsafe.dev/isamong */
80
- function isAmong(names, value) {
81
- for (const name of names) {
82
- if (name === value) {
83
- return true;
84
- }
85
- }
86
- return false;
87
- }
88
-
89
-
90
- //# sourceMappingURL=isAmong.mjs.map
91
-
92
- ;// CONCATENATED MODULE: ./dist/bin/sync-extensions/extensionModuleMeta.js
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
- const zExtensionModuleMeta = (() => {
109
- const zTargetType = lib.z.object({
110
- moduleName: lib.z.string(),
111
- version: lib.z.string(),
112
- files: lib.z.array(lib.z.object({
113
- fileRelativePath: lib.z.string(),
114
- hash: lib.z.string(),
115
- copyableFilePath: lib.z.string()
116
- })),
117
- peerDependencies: lib.z.record(lib.z.string())
118
- });
119
- (0,assert/* assert */.h)();
120
- return (0,id.id)(zTargetType);
121
- })();
122
- const zParsedCacheFile = (() => {
123
- const zTargetType = lib.z.object({
124
- keycloakifyVersion: lib.z.string(),
125
- prettierConfigHash: lib.z.union([lib.z.string(), lib.z["null"]()]),
126
- thisFilePath: lib.z.string(),
127
- extensionModuleMetas: lib.z.array(zExtensionModuleMeta)
128
- });
129
- (0,assert/* assert */.h)();
130
- return (0,id.id)(zTargetType);
131
- })();
132
- const CACHE_FILE_RELATIVE_PATH = (0,external_path_.join)("extension-modules", "cache.json");
133
- (0,assert/* assert */.h)();
134
- async function getExtensionModuleMetas(params) {
135
- const { buildContext } = params;
136
- const cacheFilePath = (0,external_path_.join)(buildContext.cacheDirPath, CACHE_FILE_RELATIVE_PATH);
137
- const keycloakifyVersion = (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)();
138
- const prettierConfigHash = await (async () => {
139
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.MT)())) {
140
- return null;
141
- }
142
- const { configHash } = await (0,runPrettier/* getPrettier */.LG)();
143
- return configHash;
144
- })();
145
- const installedExtensionModules = await (async () => {
146
- const installedModulesWithKeycloakifyInTheName = await (0,listInstalledModules/* listInstalledModules */.P)({
147
- packageJsonFilePath: buildContext.packageJsonFilePath,
148
- filter: ({ moduleName }) => moduleName.includes("keycloakify") && moduleName !== "keycloakify"
149
- });
150
- return (await Promise.all(installedModulesWithKeycloakifyInTheName.map(async (entry) => {
151
- if (!(await (0,fs_existsAsync/* existsAsync */.o)((0,external_path_.join)(entry.dirPath, constants/* KEYCLOAK_THEME */.PC)))) {
152
- return undefined;
153
- }
154
- return entry;
155
- }))).filter((0,exclude/* exclude */.D)(undefined));
156
- })();
157
- const cacheContent = await (async () => {
158
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(cacheFilePath))) {
159
- return undefined;
160
- }
161
- return await promises_.readFile(cacheFilePath);
162
- })();
163
- const extensionModuleMetas_cacheUpToDate = await (async () => {
164
- const parsedCacheFile = await (async () => {
165
- if (cacheContent === undefined) {
166
- return undefined;
167
- }
168
- const cacheContentStr = cacheContent.toString("utf8");
169
- let parsedCacheFile;
170
- try {
171
- parsedCacheFile = JSON.parse(cacheContentStr);
172
- }
173
- catch (_a) {
174
- return undefined;
175
- }
176
- try {
177
- zParsedCacheFile.parse(parsedCacheFile);
178
- }
179
- catch (_b) {
180
- return undefined;
181
- }
182
- (0,assert/* assert */.h)((0,assert.is)(parsedCacheFile));
183
- return parsedCacheFile;
184
- })();
185
- if (parsedCacheFile === undefined) {
186
- return [];
187
- }
188
- if (parsedCacheFile.keycloakifyVersion !== keycloakifyVersion) {
189
- return [];
190
- }
191
- if (parsedCacheFile.prettierConfigHash !== prettierConfigHash) {
192
- return [];
193
- }
194
- if (parsedCacheFile.thisFilePath !== cacheFilePath) {
195
- return [];
196
- }
197
- const extensionModuleMetas_cacheUpToDate = parsedCacheFile.extensionModuleMetas.filter(extensionModuleMeta => {
198
- const correspondingInstalledExtensionModule = installedExtensionModules.find(installedExtensionModule => installedExtensionModule.moduleName ===
199
- extensionModuleMeta.moduleName);
200
- if (correspondingInstalledExtensionModule === undefined) {
201
- return false;
202
- }
203
- return (correspondingInstalledExtensionModule.version ===
204
- extensionModuleMeta.version);
205
- });
206
- return extensionModuleMetas_cacheUpToDate;
207
- })();
208
- const extensionModuleMetas = await Promise.all(installedExtensionModules.map(async ({ moduleName, version, peerDependencies, dirPath }) => {
209
- use_cache: {
210
- const extensionModuleMeta_cache = extensionModuleMetas_cacheUpToDate.find(extensionModuleMeta => extensionModuleMeta.moduleName === moduleName);
211
- if (extensionModuleMeta_cache === undefined) {
212
- break use_cache;
213
- }
214
- return extensionModuleMeta_cache;
215
- }
216
- const files = [];
217
- {
218
- const srcDirPath = (0,external_path_.join)(dirPath, constants/* KEYCLOAK_THEME */.PC);
219
- await crawlAsync({
220
- dirPath: srcDirPath,
221
- returnedPathsType: "relative to dirPath",
222
- onFileFound: async (fileRelativePath) => {
223
- const sourceCode = await (0,getExtensionModuleFileSourceCodeReadyToBeCopied/* getExtensionModuleFileSourceCodeReadyToBeCopied */.p)({
224
- buildContext,
225
- fileRelativePath,
226
- isOwnershipAction: false,
227
- extensionModuleDirPath: dirPath,
228
- extensionModuleName: moduleName,
229
- extensionModuleVersion: version
230
- });
231
- const hash = computeHash(sourceCode);
232
- const copyableFilePath = (0,external_path_.join)((0,external_path_.dirname)(cacheFilePath), constants/* KEYCLOAK_THEME */.PC, fileRelativePath);
233
- {
234
- const dirPath = (0,external_path_.dirname)(copyableFilePath);
235
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
236
- await promises_.mkdir(dirPath, { recursive: true });
237
- }
238
- }
239
- promises_.writeFile(copyableFilePath, sourceCode);
240
- files.push({
241
- fileRelativePath,
242
- hash,
243
- copyableFilePath
244
- });
245
- }
246
- });
247
- }
248
- return (0,id.id)({
249
- moduleName,
250
- version,
251
- files,
252
- peerDependencies: Object.fromEntries(Object.entries(peerDependencies).filter(([moduleName]) => !isAmong(["react", "@types/react"], moduleName)))
253
- });
254
- }));
255
- update_cache: {
256
- const parsedCacheFile = (0,id.id)({
257
- keycloakifyVersion,
258
- prettierConfigHash,
259
- thisFilePath: cacheFilePath,
260
- extensionModuleMetas
261
- });
262
- const cacheContent_new = Buffer.from(JSON.stringify(parsedCacheFile, null, 2), "utf8");
263
- if (cacheContent !== undefined && cacheContent_new.equals(cacheContent)) {
264
- break update_cache;
265
- }
266
- create_dir: {
267
- const dirPath = (0,external_path_.dirname)(cacheFilePath);
268
- if (await (0,fs_existsAsync/* existsAsync */.o)(dirPath)) {
269
- break create_dir;
270
- }
271
- await promises_.mkdir(dirPath, { recursive: true });
272
- }
273
- await promises_.writeFile(cacheFilePath, cacheContent_new);
274
- }
275
- return extensionModuleMetas;
276
- }
277
- function computeHash(data) {
278
- return external_crypto_.createHash("sha256").update(data).digest("hex");
279
- }
280
- //# sourceMappingURL=extensionModuleMeta.js.map
281
-
282
- /***/ }),
283
-
284
- /***/ 2237:
285
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
286
-
287
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
288
- /* harmony export */ "p": () => (/* binding */ getExtensionModuleFileSourceCodeReadyToBeCopied)
289
- /* harmony export */ });
290
- /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48433);
291
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73292);
292
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
293
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71017);
294
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
295
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
296
- /* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(173);
297
-
298
-
299
-
300
-
301
-
302
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)();
303
- async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
304
- const { buildContext, extensionModuleDirPath, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
305
- let sourceCode = (await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(extensionModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, fileRelativePath))).toString("utf8");
306
- sourceCode = addCommentToSourceCode({
307
- sourceCode,
308
- fileRelativePath,
309
- commentLines: (() => {
310
- const path = fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/");
311
- return isOwnershipAction
312
- ? [
313
- `This file has been claimed for ownership from ${extensionModuleName} version ${extensionModuleVersion}.`,
314
- `To relinquish ownership and restore this file to its original content, run the following command:`,
315
- ``,
316
- `$ npx keycloakify own --path "${path}" --revert`
317
- ]
318
- : [
319
- `WARNING: Before modifying this file, run the following command:`,
320
- ``,
321
- `$ npx keycloakify own --path "${path}"`,
322
- ``,
323
- `This file is provided by ${extensionModuleName} version ${extensionModuleVersion}.`,
324
- `It was copied into your repository by the postinstall script: \`keycloakify sync-extensions\`.`
325
- ];
326
- })()
327
- });
328
- const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
329
- format: {
330
- if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
331
- break format;
332
- }
333
- sourceCode = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .runPrettier */ .eY)({
334
- filePath: destFilePath,
335
- sourceCode
336
- });
337
- }
338
- return Buffer.from(sourceCode, "utf8");
339
- }
340
- function addCommentToSourceCode(params) {
341
- const { sourceCode, fileRelativePath, commentLines } = params;
342
- const toResult = (comment) => {
343
- return [comment, ``, sourceCode].join("\n");
344
- };
345
- for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
346
- if (!fileRelativePath.endsWith(ext)) {
347
- continue;
348
- }
349
- return toResult([`/**`, ...commentLines.map(line => ` * ${line}`), ` */`].join("\n"));
350
- }
351
- if (fileRelativePath.endsWith(".properties")) {
352
- return toResult(commentLines.map(line => `# ${line}`).join("\n"));
353
- }
354
- if (fileRelativePath.endsWith(".ftl")) {
355
- const comment = [`<#--`, ...commentLines.map(line => ` ${line}`), `-->`].join("\n");
356
- if (sourceCode.trim().startsWith("<#ftl")) {
357
- const [first, ...rest] = sourceCode.split(">");
358
- const last = rest.join(">");
359
- return [`${first}>`, comment, last].join("\n");
360
- }
361
- return toResult(comment);
362
- }
363
- if (fileRelativePath.endsWith(".html") || fileRelativePath.endsWith(".svg")) {
364
- const comment = [
365
- `<!--`,
366
- ...commentLines.map(line => ` ${line
367
- .replace("--path", "-t")
368
- .replace("--revert", "-r")
369
- .replace("Before modifying", "Before modifying or replacing")}`),
370
- `-->`
371
- ].join("\n");
372
- if (fileRelativePath.endsWith(".html") && sourceCode.trim().startsWith("<!")) {
373
- const [first, ...rest] = sourceCode.split(">");
374
- const last = rest.join(">");
375
- return [`${first}>`, comment, last].join("\n");
376
- }
377
- if (fileRelativePath.endsWith(".svg") && sourceCode.trim().startsWith("<?")) {
378
- const [first, ...rest] = sourceCode.split("?>");
379
- const last = rest.join("?>");
380
- return [`${first}?>`, comment, last].join("\n");
381
- }
382
- return toResult(comment);
383
- }
384
- return sourceCode;
385
- }
386
- //# sourceMappingURL=getExtensionModuleFileSourceCodeReadyToBeCopied.js.map
387
-
388
- /***/ }),
389
-
390
- /***/ 69674:
391
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
392
-
393
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
394
- /* harmony export */ "Y": () => (/* binding */ writeManagedGitignoreFile),
395
- /* harmony export */ "w": () => (/* binding */ readManagedGitignoreFile)
396
- /* harmony export */ });
397
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
398
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
399
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
400
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
401
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
402
- /* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
403
- /* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84794);
404
-
405
-
406
-
407
-
408
-
409
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
410
- const DELIMITER_START = `# === Owned files start ===`;
411
- const DELIMITER_END = `# === Owned files end =====`;
412
- async function writeManagedGitignoreFile(params) {
413
- const { buildContext, extensionModuleMetas, ownedFilesRelativePaths } = params;
414
- if (extensionModuleMetas.length === 0) {
415
- return;
416
- }
417
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, ".gitignore");
418
- const content_new = Buffer.from([
419
- `# This file is managed by Keycloakify, do not edit it manually.`,
420
- ``,
421
- DELIMITER_START,
422
- ...ownedFilesRelativePaths
423
- .map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
424
- .map(line => `# ${line}`),
425
- DELIMITER_END,
426
- ``,
427
- ...extensionModuleMetas
428
- .map(extensionModuleMeta => [
429
- `# === ${extensionModuleMeta.moduleName} v${extensionModuleMeta.version} ===`,
430
- ...extensionModuleMeta.files
431
- .map(({ fileRelativePath }) => fileRelativePath)
432
- .filter(fileRelativePath => !ownedFilesRelativePaths.includes(fileRelativePath))
433
- .map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`),
434
- ``
435
- ])
436
- .flat()
437
- ].join("\n"), "utf8");
438
- const content_current = await (async () => {
439
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
440
- return undefined;
441
- }
442
- return await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath);
443
- })();
444
- if (content_current !== undefined && content_current.equals(content_new)) {
445
- return;
446
- }
447
- create_dir: {
448
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
449
- if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
450
- break create_dir;
451
- }
452
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.mkdir(dirPath, { recursive: true });
453
- }
454
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
455
- }
456
- async function readManagedGitignoreFile(params) {
457
- const { buildContext } = params;
458
- const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, ".gitignore");
459
- if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
460
- return { ownedFilesRelativePaths: [] };
461
- }
462
- const contentStr = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
463
- const payload = (() => {
464
- const index_start = contentStr.indexOf(DELIMITER_START);
465
- const index_end = contentStr.indexOf(DELIMITER_END);
466
- if (index_start === -1 || index_end === -1) {
467
- return undefined;
468
- }
469
- return contentStr.slice(index_start + DELIMITER_START.length, index_end).trim();
470
- })();
471
- if (payload === undefined) {
472
- return { ownedFilesRelativePaths: [] };
473
- }
474
- const ownedFilesRelativePaths = payload
475
- .split("\n")
476
- .map(line => line.trim())
477
- .map(line => line.replace(/^# /, ""))
478
- .filter(line => line !== "")
479
- .map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
480
- cwd: buildContext.themeSrcDirPath,
481
- pathIsh: line
482
- }))
483
- .map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath));
484
- return { ownedFilesRelativePaths };
485
- }
486
- //# sourceMappingURL=managedGitignoreFile.js.map
487
-
488
- /***/ }),
489
-
490
- /***/ 28363:
491
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
492
-
493
-
494
- // EXPORTS
495
- __webpack_require__.d(__webpack_exports__, {
496
- "W": () => (/* binding */ command)
497
- });
498
-
499
- // EXTERNAL MODULE: ./dist/bin/sync-extensions/extensionModuleMeta.js + 2 modules
500
- var sync_extensions_extensionModuleMeta = __webpack_require__(77372);
501
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
502
- var assert = __webpack_require__(29041);
503
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
504
- var lib = __webpack_require__(52300);
505
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
506
- var id = __webpack_require__(38469);
507
- // EXTERNAL MODULE: external "fs/promises"
508
- var promises_ = __webpack_require__(73292);
509
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
510
- var SemVer = __webpack_require__(12171);
511
- // EXTERNAL MODULE: ./node_modules/evt/tools/inDepth/same.js
512
- var same = __webpack_require__(33805);
513
- // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
514
- var runPrettier = __webpack_require__(48433);
515
- // EXTERNAL MODULE: ./dist/bin/tools/npmInstall.js + 1 modules
516
- var npmInstall = __webpack_require__(63046);
517
- // EXTERNAL MODULE: external "path"
518
- var external_path_ = __webpack_require__(71017);
519
- ;// CONCATENATED MODULE: ./dist/bin/sync-extensions/installExtensionModulesPeerDependencies.js
520
-
521
-
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
- (0,assert/* assert */.h)();
530
- (0,assert/* assert */.h)();
531
- async function installExtensionModulesPeerDependencies(params) {
532
- var _a, _b;
533
- const { buildContext, extensionModuleMetas } = params;
534
- const { extensionModulesPerDependencies } = (() => {
535
- const extensionModulesPerDependencies = {};
536
- for (const { peerDependencies } of extensionModuleMetas) {
537
- for (const [peerDependencyName, versionRange_candidate] of Object.entries(peerDependencies)) {
538
- const versionRange = (() => {
539
- const versionRange_current = extensionModulesPerDependencies[peerDependencyName];
540
- if (versionRange_current === undefined) {
541
- return versionRange_candidate;
542
- }
543
- if (versionRange_current === "*") {
544
- return versionRange_candidate;
545
- }
546
- if (versionRange_candidate === "*") {
547
- return versionRange_current;
548
- }
549
- const { versionRange } = [
550
- versionRange_current,
551
- versionRange_candidate
552
- ]
553
- .map(versionRange => ({
554
- versionRange,
555
- semVer: SemVer/* SemVer.parse */.h.parse((() => {
556
- if (versionRange.startsWith("^") ||
557
- versionRange.startsWith("~")) {
558
- return versionRange.slice(1);
559
- }
560
- return versionRange;
561
- })())
562
- }))
563
- .sort((a, b) => SemVer/* SemVer.compare */.h.compare(b.semVer, a.semVer))[0];
564
- return versionRange;
565
- })();
566
- extensionModulesPerDependencies[peerDependencyName] = versionRange;
567
- }
568
- }
569
- return { extensionModulesPerDependencies };
570
- })();
571
- const parsedPackageJson = await (async () => {
572
- const zParsedPackageJson = (() => {
573
- const zParsedPackageJson = lib.z.object({
574
- dependencies: lib.z.record(lib.z.string()).optional(),
575
- devDependencies: lib.z.record(lib.z.string()).optional()
576
- });
577
- (0,assert/* assert */.h)();
578
- return (0,id.id)(zParsedPackageJson);
579
- })();
580
- const parsedPackageJson = JSON.parse((await promises_.readFile(buildContext.packageJsonFilePath)).toString("utf8"));
581
- zParsedPackageJson.parse(parsedPackageJson);
582
- (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
583
- return parsedPackageJson;
584
- })();
585
- const parsedPackageJson_before = JSON.parse(JSON.stringify(parsedPackageJson));
586
- for (const [moduleName, versionRange] of Object.entries(extensionModulesPerDependencies)) {
587
- if (moduleName.startsWith("@types/")) {
588
- ((_a = parsedPackageJson.devDependencies) !== null && _a !== void 0 ? _a : (parsedPackageJson.devDependencies = {}))[moduleName] = versionRange;
589
- continue;
590
- }
591
- if (parsedPackageJson.devDependencies !== undefined) {
592
- delete parsedPackageJson.devDependencies[moduleName];
593
- }
594
- ((_b = parsedPackageJson.dependencies) !== null && _b !== void 0 ? _b : (parsedPackageJson.dependencies = {}))[moduleName] = versionRange;
595
- }
596
- if ((0,same.same)(parsedPackageJson, parsedPackageJson_before)) {
597
- return;
598
- }
599
- let packageJsonContentStr = JSON.stringify(parsedPackageJson, null, 2);
600
- format: {
601
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.MT)())) {
602
- break format;
603
- }
604
- packageJsonContentStr = await (0,runPrettier/* runPrettier */.eY)({
605
- sourceCode: packageJsonContentStr,
606
- filePath: buildContext.packageJsonFilePath
607
- });
608
- }
609
- await promises_.writeFile(buildContext.packageJsonFilePath, packageJsonContentStr);
610
- await (0,npmInstall/* npmInstall */.c)({
611
- packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
612
- });
613
- process.exit(0);
614
- }
615
- //# sourceMappingURL=installExtensionModulesPeerDependencies.js.map
616
- // EXTERNAL MODULE: ./dist/bin/sync-extensions/managedGitignoreFile.js
617
- var managedGitignoreFile = __webpack_require__(69674);
618
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
619
- var fs_existsAsync = __webpack_require__(43765);
620
- // EXTERNAL MODULE: external "child_process"
621
- var external_child_process_ = __webpack_require__(32081);
622
- // EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
623
- var Deferred = __webpack_require__(50689);
624
- // EXTERNAL MODULE: external "fs"
625
- var external_fs_ = __webpack_require__(57147);
626
- ;// CONCATENATED MODULE: ./dist/bin/tools/isKnownByGit.js
627
-
628
-
629
-
630
-
631
- function getIsKnownByGit(params) {
632
- const { filePath } = params;
633
- const dIsKnownByGit = new Deferred.Deferred();
634
- let relativePath = (0,external_path_.basename)(filePath);
635
- let dirPath = (0,external_path_.dirname)(filePath);
636
- while (!external_fs_.existsSync(dirPath)) {
637
- relativePath = (0,external_path_.join)((0,external_path_.basename)(dirPath), relativePath);
638
- dirPath = (0,external_path_.dirname)(dirPath);
639
- }
640
- external_child_process_.exec(`git ls-files --error-unmatch '${relativePath.split(external_path_.sep).join("/")}'`, { cwd: dirPath }, error => {
641
- if (error === null) {
642
- dIsKnownByGit.resolve(true);
643
- return;
644
- }
645
- if (error.code === 1) {
646
- dIsKnownByGit.resolve(false);
647
- return;
648
- }
649
- dIsKnownByGit.reject(error);
650
- });
651
- return dIsKnownByGit.pr;
652
- }
653
- //# sourceMappingURL=isKnownByGit.js.map
654
- ;// CONCATENATED MODULE: ./dist/bin/tools/untrackFromGit.js
655
-
656
-
657
-
658
-
659
- async function untrackFromGit(params) {
660
- const { filePath } = params;
661
- const dDone = new Deferred.Deferred();
662
- let relativePath = (0,external_path_.basename)(filePath);
663
- let dirPath = (0,external_path_.dirname)(filePath);
664
- while (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
665
- relativePath = (0,external_path_.join)((0,external_path_.basename)(dirPath), relativePath);
666
- dirPath = (0,external_path_.dirname)(dirPath);
667
- }
668
- external_child_process_.exec(`git rm --cached '${relativePath.split(external_path_.sep).join("/")}'`, { cwd: dirPath }, error => {
669
- if (error !== null) {
670
- dDone.reject(error);
671
- return;
672
- }
673
- dDone.resolve();
674
- });
675
- await dDone.pr;
676
- }
677
- //# sourceMappingURL=untrackFromGit.js.map
678
- ;// CONCATENATED MODULE: ./dist/bin/sync-extensions/sync-extension.js
679
-
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
-
688
- async function command(params) {
689
- const { buildContext } = params;
690
- const extensionModuleMetas = await (0,sync_extensions_extensionModuleMeta/* getExtensionModuleMetas */.f)({ buildContext });
691
- await installExtensionModulesPeerDependencies({
692
- buildContext,
693
- extensionModuleMetas
694
- });
695
- const { ownedFilesRelativePaths } = await (0,managedGitignoreFile/* readManagedGitignoreFile */.w)({
696
- buildContext
697
- });
698
- await (0,managedGitignoreFile/* writeManagedGitignoreFile */.Y)({
699
- buildContext,
700
- ownedFilesRelativePaths,
701
- extensionModuleMetas
702
- });
703
- await Promise.all(extensionModuleMetas
704
- .map(extensionModuleMeta => Promise.all(extensionModuleMeta.files.map(async ({ fileRelativePath, copyableFilePath, hash }) => {
705
- if (ownedFilesRelativePaths.includes(fileRelativePath)) {
706
- return;
707
- }
708
- const destFilePath = (0,external_path_.join)(buildContext.themeSrcDirPath, fileRelativePath);
709
- const doesFileExist = await (0,fs_existsAsync/* existsAsync */.o)(destFilePath);
710
- skip_condition: {
711
- if (!doesFileExist) {
712
- break skip_condition;
713
- }
714
- const destFileHash = (0,sync_extensions_extensionModuleMeta/* computeHash */.x)(await promises_.readFile(destFilePath));
715
- if (destFileHash !== hash) {
716
- break skip_condition;
717
- }
718
- return;
719
- }
720
- if (await getIsKnownByGit({ filePath: destFilePath })) {
721
- await untrackFromGit({
722
- filePath: destFilePath
723
- });
724
- }
725
- {
726
- const dirName = (0,external_path_.dirname)(destFilePath);
727
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirName))) {
728
- await promises_.mkdir(dirName, { recursive: true });
729
- }
730
- }
731
- await promises_.copyFile(copyableFilePath, destFilePath);
732
- })))
733
- .flat());
734
- }
735
- //# sourceMappingURL=sync-extension.js.map
736
-
737
- /***/ }),
738
-
739
- /***/ 12171:
740
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
741
-
742
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
743
- /* harmony export */ "h": () => (/* binding */ SemVer)
744
- /* harmony export */ });
745
- var SemVer;
746
- (function (SemVer) {
747
- const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
748
- function parse(versionStr) {
749
- const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
750
- if (!match) {
751
- throw new Error(`${versionStr} is not a valid semantic version`);
752
- }
753
- const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
754
- const str = match[3];
755
- return str === undefined ? 0 : parseInt(str);
756
- })() }, (() => {
757
- const str = match[4];
758
- return str === undefined ? {} : { rc: parseInt(str) };
759
- })());
760
- const initialStr = stringify(semVer);
761
- Object.defineProperty(semVer, "parsedFrom", {
762
- enumerable: true,
763
- get: function () {
764
- const currentStr = stringify(this);
765
- if (currentStr !== initialStr) {
766
- throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
767
- }
768
- return versionStr;
769
- }
770
- });
771
- return semVer;
772
- }
773
- SemVer.parse = parse;
774
- function stringify(v) {
775
- return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
776
- }
777
- SemVer.stringify = stringify;
778
- /**
779
- *
780
- * v1 < v2 => -1
781
- * v1 === v2 => 0
782
- * v1 > v2 => 1
783
- *
784
- */
785
- function compare(v1, v2) {
786
- const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
787
- const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
788
- for (const level of ["major", "minor", "patch", "rc"]) {
789
- if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
790
- return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
791
- }
792
- }
793
- return 0;
794
- }
795
- SemVer.compare = compare;
796
- /*
797
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
798
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
799
- console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
800
- */
801
- function bumpType(params) {
802
- const versionAhead = typeof params.versionAhead === "string"
803
- ? parse(params.versionAhead)
804
- : params.versionAhead;
805
- const versionBehind = typeof params.versionBehind === "string"
806
- ? parse(params.versionBehind)
807
- : params.versionBehind;
808
- if (compare(versionBehind, versionAhead) === 1) {
809
- throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
810
- }
811
- for (const level of ["major", "minor", "patch", "rc"]) {
812
- if (versionBehind[level] !== versionAhead[level]) {
813
- return level;
814
- }
815
- }
816
- return "no bump";
817
- }
818
- SemVer.bumpType = bumpType;
819
- })(SemVer || (SemVer = {}));
820
- //# sourceMappingURL=SemVer.js.map
821
-
822
- /***/ }),
823
-
824
- /***/ 43765:
825
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
826
-
827
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
828
- /* harmony export */ "o": () => (/* binding */ existsAsync)
829
- /* harmony export */ });
830
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
831
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
832
-
833
- async function existsAsync(path) {
834
- try {
835
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
836
- return true;
837
- }
838
- catch (error) {
839
- if (error.code === "ENOENT")
840
- return false;
841
- throw error;
842
- }
843
- }
844
- //# sourceMappingURL=fs.existsAsync.js.map
845
-
846
- /***/ }),
847
-
848
- /***/ 89693:
849
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
850
-
851
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
852
- /* harmony export */ "a": () => (/* binding */ rmSync)
853
- /* harmony export */ });
854
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
855
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
856
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
857
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
858
- /* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
859
-
860
-
861
-
862
- /**
863
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
864
- * For older version of Node
865
- */
866
- function rmSync(dirPath, options) {
867
- 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) {
868
- fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
869
- return;
870
- }
871
- const { force = true } = options;
872
- if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
873
- return;
874
- }
875
- const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
876
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
877
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
878
- removeDir_rec(fileOrDirPath);
879
- return;
880
- }
881
- else {
882
- fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
883
- }
884
- });
885
- removeDir_rec(dirPath);
886
- }
887
- //# sourceMappingURL=fs.rmSync.js.map
888
-
889
- /***/ }),
890
-
891
- /***/ 93721:
892
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
893
-
894
-
895
- // EXPORTS
896
- __webpack_require__.d(__webpack_exports__, {
897
- "p": () => (/* binding */ getInstalledModuleDirPath)
898
- });
899
-
900
- // EXTERNAL MODULE: external "path"
901
- var external_path_ = __webpack_require__(71017);
902
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
903
- var fs_existsAsync = __webpack_require__(43765);
904
- // EXTERNAL MODULE: external "child_process"
905
- var external_child_process_ = __webpack_require__(32081);
906
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
907
- var assert = __webpack_require__(29041);
908
- ;// CONCATENATED MODULE: ./dist/bin/tools/isRootPath.js
909
-
910
- function getIsRootPath(filePath) {
911
- const path_normalized = (0,external_path_.normalize)(filePath);
912
- // Unix-like root ("/")
913
- if (path_normalized === "/") {
914
- return true;
915
- }
916
- // Check for Windows drive root (e.g., "C:\\")
917
- if (/^[a-zA-Z]:\\$/.test(path_normalized)) {
918
- return true;
919
- }
920
- // Check for UNC root (e.g., "\\server\share")
921
- if (/^\\\\[^\\]+\\[^\\]+\\?$/.test(path_normalized)) {
922
- return true;
923
- }
924
- return false;
925
- }
926
- //# sourceMappingURL=isRootPath.js.map
927
- ;// CONCATENATED MODULE: ./dist/bin/tools/getInstalledModuleDirPath.js
928
-
929
-
930
-
931
-
932
-
933
- async function getInstalledModuleDirPath(params) {
934
- const { moduleName, packageJsonDirPath } = params;
935
- {
936
- let dirPath = packageJsonDirPath;
937
- while (true) {
938
- const dirPath_candidate = (0,external_path_.join)(dirPath, "node_modules", ...moduleName.split("/"));
939
- let doesExist;
940
- try {
941
- doesExist = await (0,fs_existsAsync/* existsAsync */.o)(dirPath_candidate);
942
- }
943
- catch (_a) {
944
- doesExist = false;
945
- }
946
- if (doesExist) {
947
- return dirPath_candidate;
948
- }
949
- if (getIsRootPath(dirPath)) {
950
- break;
951
- }
952
- dirPath = (0,external_path_.join)(dirPath, "..");
953
- }
954
- }
955
- const dirPath = external_child_process_.execSync(`npm list ${moduleName}`, {
956
- cwd: packageJsonDirPath
957
- })
958
- .toString("utf8")
959
- .trim();
960
- (0,assert/* assert */.h)(dirPath !== "");
961
- return dirPath;
962
- }
963
- //# sourceMappingURL=getInstalledModuleDirPath.js.map
964
-
965
- /***/ }),
966
-
967
- /***/ 75564:
968
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
969
-
970
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
971
- /* harmony export */ "P": () => (/* binding */ listInstalledModules)
972
- /* harmony export */ });
973
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29041);
974
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38469);
975
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(52300);
976
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
977
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
978
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
979
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
980
- /* harmony import */ var _tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(93721);
981
- /* harmony import */ var tsafe_exclude__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83101);
982
-
983
-
984
-
985
-
986
-
987
-
988
-
989
- async function listInstalledModules(params) {
990
- const { packageJsonFilePath, filter } = params;
991
- const parsedPackageJson = await readPackageJsonDependencies({
992
- packageJsonFilePath
993
- });
994
- const extensionModuleNames = [parsedPackageJson.dependencies, parsedPackageJson.devDependencies]
995
- .filter((0,tsafe_exclude__WEBPACK_IMPORTED_MODULE_4__/* .exclude */ .D)(undefined))
996
- .map(obj => Object.keys(obj))
997
- .flat()
998
- .filter(moduleName => filter({ moduleName }));
999
- const result = await Promise.all(extensionModuleNames.map(async (moduleName) => {
1000
- const dirPath = await (0,_tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_3__/* .getInstalledModuleDirPath */ .p)({
1001
- moduleName,
1002
- packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
1003
- });
1004
- const { version, peerDependencies } = await readPackageJsonVersionAndPeerDependencies({
1005
- packageJsonFilePath: (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, "package.json")
1006
- });
1007
- return { moduleName, version, peerDependencies, dirPath };
1008
- }));
1009
- return result;
1010
- }
1011
- const { readPackageJsonDependencies } = (() => {
1012
- const zParsedPackageJson = (() => {
1013
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
1014
- dependencies: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional(),
1015
- devDependencies: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
1016
- });
1017
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .h)();
1018
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
1019
- })();
1020
- async function readPackageJsonDependencies(params) {
1021
- const { packageJsonFilePath } = params;
1022
- const parsedPackageJson = JSON.parse((await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(packageJsonFilePath)).toString("utf8"));
1023
- zParsedPackageJson.parse(parsedPackageJson);
1024
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__.is)(parsedPackageJson));
1025
- return parsedPackageJson;
1026
- }
1027
- return { readPackageJsonDependencies };
1028
- })();
1029
- const { readPackageJsonVersionAndPeerDependencies } = (() => {
1030
- const zParsedPackageJson = (() => {
1031
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
1032
- version: zod__WEBPACK_IMPORTED_MODULE_5__.z.string(),
1033
- peerDependencies: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
1034
- });
1035
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .h)();
1036
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
1037
- })();
1038
- async function readPackageJsonVersionAndPeerDependencies(params) {
1039
- var _a;
1040
- const { packageJsonFilePath } = params;
1041
- const parsedPackageJson = JSON.parse((await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(packageJsonFilePath)).toString("utf8"));
1042
- zParsedPackageJson.parse(parsedPackageJson);
1043
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__.is)(parsedPackageJson));
1044
- return {
1045
- version: parsedPackageJson.version,
1046
- peerDependencies: (_a = parsedPackageJson.peerDependencies) !== null && _a !== void 0 ? _a : {}
1047
- };
1048
- }
1049
- return { readPackageJsonVersionAndPeerDependencies };
1050
- })();
1051
- //# sourceMappingURL=listInstalledModules.js.map
1052
-
1053
- /***/ }),
1054
-
1055
- /***/ 73776:
1056
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1057
-
1058
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1059
- /* harmony export */ "K": () => (/* binding */ getNodeModulesBinDirPath)
1060
- /* harmony export */ });
1061
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1062
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1063
- /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58822);
1064
- /* harmony import */ var _getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93721);
1065
- /* harmony import */ var _fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
1066
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52300);
1067
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(73292);
1068
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_4__);
1069
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
1070
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
1071
-
1072
-
1073
-
1074
-
1075
-
1076
-
1077
-
1078
-
1079
- let cache_bestEffort = undefined;
1080
- /** NOTE: Careful, this function can fail when the binary
1081
- * Used is not in the node_modules directory of the project
1082
- * (for example when running tests with vscode extension we'll get
1083
- * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
1084
- *
1085
- * instead of
1086
- * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
1087
- * or
1088
- * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
1089
- *
1090
- * as the value of process.argv[1]
1091
- */
1092
- function getNodeModulesBinDirPath_bestEffort() {
1093
- if (cache_bestEffort !== undefined) {
1094
- return cache_bestEffort;
1095
- }
1096
- const binPath = process.argv[1];
1097
- special_case_running_not_from_distribution: {
1098
- if (!binPath.endsWith(".ts")) {
1099
- break special_case_running_not_from_distribution;
1100
- }
1101
- const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .B)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
1102
- const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, "node_modules", ".bin");
1103
- return nodeModulesBinDirPath;
1104
- }
1105
- const segments = [".bin"];
1106
- let foundNodeModules = false;
1107
- for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
1108
- skip_segment: {
1109
- if (foundNodeModules) {
1110
- break skip_segment;
1111
- }
1112
- if (segment === "node_modules") {
1113
- foundNodeModules = true;
1114
- break skip_segment;
1115
- }
1116
- continue;
1117
- }
1118
- segments.unshift(segment);
1119
- }
1120
- if (!foundNodeModules) {
1121
- throw new Error(`Could not find node_modules in path ${binPath}`);
1122
- }
1123
- const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
1124
- cache_bestEffort = nodeModulesBinDirPath;
1125
- return nodeModulesBinDirPath;
1126
- }
1127
- let cache_withPackageJsonFileDirPath = undefined;
1128
- async function getNodeModulesBinDirPath_withPackageJsonFileDirPath(params) {
1129
- const { packageJsonFilePath } = params;
1130
- use_cache: {
1131
- if (cache_withPackageJsonFileDirPath === undefined) {
1132
- break use_cache;
1133
- }
1134
- if (cache_withPackageJsonFileDirPath.packageJsonFilePath !== packageJsonFilePath) {
1135
- cache_withPackageJsonFileDirPath = undefined;
1136
- break use_cache;
1137
- }
1138
- return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
1139
- }
1140
- // [...]node_modules/keycloakify
1141
- const installedModuleDirPath = await (0,_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getInstalledModuleDirPath */ .p)({
1142
- // Here it will always be "keycloakify" but since we are in tools/ we make something generic
1143
- moduleName: await (async () => {
1144
- const zParsedPackageJson = (() => {
1145
- const zTargetType = zod__WEBPACK_IMPORTED_MODULE_6__.z.object({
1146
- name: zod__WEBPACK_IMPORTED_MODULE_6__.z.string()
1147
- });
1148
- tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h;
1149
- return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(zTargetType);
1150
- })();
1151
- const parsedPackageJson = JSON.parse((await fs_promises__WEBPACK_IMPORTED_MODULE_4__.readFile((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getThisCodebaseRootDirPath */ .e)(), "package.json"))).toString("utf8"));
1152
- zParsedPackageJson.parse(parsedPackageJson);
1153
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(parsedPackageJson));
1154
- return parsedPackageJson.name;
1155
- })(),
1156
- packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(packageJsonFilePath)
1157
- });
1158
- const segments = installedModuleDirPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep);
1159
- while (true) {
1160
- const segment = segments.pop();
1161
- if (segment === undefined) {
1162
- throw new Error(`Could not find .bin directory relative to ${packageJsonFilePath}`);
1163
- }
1164
- if (segment !== "node_modules") {
1165
- continue;
1166
- }
1167
- const candidate = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep), segment, ".bin");
1168
- if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(candidate))) {
1169
- continue;
1170
- }
1171
- cache_withPackageJsonFileDirPath = {
1172
- packageJsonFilePath,
1173
- nodeModulesBinDirPath: candidate
1174
- };
1175
- break;
1176
- }
1177
- return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
1178
- }
1179
- function getNodeModulesBinDirPath(params) {
1180
- const { packageJsonFilePath } = params !== null && params !== void 0 ? params : {};
1181
- return packageJsonFilePath === undefined
1182
- ? getNodeModulesBinDirPath_bestEffort()
1183
- : getNodeModulesBinDirPath_withPackageJsonFileDirPath({ packageJsonFilePath });
1184
- }
1185
- //# sourceMappingURL=nodeModulesBinDirPath.js.map
1186
-
1187
- /***/ }),
1188
-
1189
- /***/ 63046:
1190
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1191
-
1192
-
1193
- // EXPORTS
1194
- __webpack_require__.d(__webpack_exports__, {
1195
- "c": () => (/* binding */ npmInstall)
1196
- });
1197
-
1198
- // EXTERNAL MODULE: external "fs"
1199
- var external_fs_ = __webpack_require__(57147);
1200
- // EXTERNAL MODULE: external "path"
1201
- var external_path_ = __webpack_require__(71017);
1202
- // EXTERNAL MODULE: external "child_process"
1203
- var external_child_process_ = __webpack_require__(32081);
1204
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
1205
- var source = __webpack_require__(78818);
1206
- var source_default = /*#__PURE__*/__webpack_require__.n(source);
1207
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
1208
- var lib = __webpack_require__(52300);
1209
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
1210
- var assert = __webpack_require__(29041);
1211
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
1212
- var id = __webpack_require__(38469);
1213
- ;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
1214
- /** https://docs.tsafe.dev/objectKeys */
1215
- function objectKeys(o) {
1216
- return Object.keys(o);
1217
- }
1218
-
1219
-
1220
- //# sourceMappingURL=objectKeys.mjs.map
1221
-
1222
- // EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
1223
- var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
1224
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
1225
- var exclude = __webpack_require__(83101);
1226
- // EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
1227
- var fs_rmSync = __webpack_require__(89693);
1228
- // EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
1229
- var Deferred = __webpack_require__(50689);
1230
- ;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
1231
-
1232
-
1233
-
1234
-
1235
-
1236
-
1237
-
1238
-
1239
-
1240
-
1241
-
1242
-
1243
- async function npmInstall(params) {
1244
- const { packageJsonDirPath } = params;
1245
- const packageManagerBinName = (() => {
1246
- const packageMangers = [
1247
- {
1248
- binName: "yarn",
1249
- lockFileBasename: "yarn.lock"
1250
- },
1251
- {
1252
- binName: "npm",
1253
- lockFileBasename: "package-lock.json"
1254
- },
1255
- {
1256
- binName: "pnpm",
1257
- lockFileBasename: "pnpm-lock.yaml"
1258
- },
1259
- {
1260
- binName: "bun",
1261
- lockFileBasename: "bun.lockdb"
1262
- },
1263
- {
1264
- binName: "deno",
1265
- lockFileBasename: "deno.lock"
1266
- }
1267
- ];
1268
- for (const packageManager of packageMangers) {
1269
- if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
1270
- external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
1271
- return packageManager.binName;
1272
- }
1273
- }
1274
- throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
1275
- })();
1276
- console.log(`Installing the new dependencies...`);
1277
- install_without_breaking_links: {
1278
- if (packageManagerBinName !== "yarn") {
1279
- break install_without_breaking_links;
1280
- }
1281
- const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
1282
- if (garronejLinkInfos === undefined) {
1283
- break install_without_breaking_links;
1284
- }
1285
- console.log(source_default().green("Installing in a way that won't break the links..."));
1286
- await installWithoutBreakingLinks({
1287
- packageJsonDirPath,
1288
- garronejLinkInfos
1289
- });
1290
- return;
1291
- }
1292
- try {
1293
- await runPackageManagerInstall({
1294
- packageManagerBinName,
1295
- cwd: packageJsonDirPath
1296
- });
1297
- }
1298
- catch (_a) {
1299
- console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
1300
- }
1301
- }
1302
- async function runPackageManagerInstall(params) {
1303
- const { packageManagerBinName, cwd } = params;
1304
- const dCompleted = new Deferred.Deferred();
1305
- const child = external_child_process_.spawn(packageManagerBinName, ["install"], {
1306
- cwd,
1307
- env: process.env,
1308
- shell: true
1309
- });
1310
- child.stdout.on("data", data => process.stdout.write(data));
1311
- child.stderr.on("data", data => {
1312
- if (data.toString("utf8").includes("peer dependency")) {
1313
- return;
1314
- }
1315
- process.stderr.write(data);
1316
- });
1317
- child.on("exit", code => {
1318
- if (code !== 0) {
1319
- dCompleted.reject(new Error(`Failed with code ${code}`));
1320
- return;
1321
- }
1322
- dCompleted.resolve();
1323
- });
1324
- await dCompleted.pr;
1325
- }
1326
- function getGarronejLinkInfos(params) {
1327
- const { packageJsonDirPath } = params;
1328
- const nodeModuleDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
1329
- if (!external_fs_.existsSync(nodeModuleDirPath)) {
1330
- return undefined;
1331
- }
1332
- const linkedModuleNames = [];
1333
- let yarnHomeDirPath = undefined;
1334
- const getIsLinkedByGarronejScript = (path) => {
1335
- let realPath;
1336
- try {
1337
- realPath = external_fs_.readlinkSync(path);
1338
- }
1339
- catch (_a) {
1340
- return false;
1341
- }
1342
- const doesIncludeYarnHome = realPath.includes(".yarn_home");
1343
- if (!doesIncludeYarnHome) {
1344
- return false;
1345
- }
1346
- set_yarnHomeDirPath: {
1347
- if (yarnHomeDirPath !== undefined) {
1348
- break set_yarnHomeDirPath;
1349
- }
1350
- const [firstElement] = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
1351
- pathIsh: realPath,
1352
- cwd: (0,external_path_.dirname)(path)
1353
- }).split(".yarn_home");
1354
- yarnHomeDirPath = (0,external_path_.join)(firstElement, ".yarn_home");
1355
- }
1356
- return true;
1357
- };
1358
- for (const basename of external_fs_.readdirSync(nodeModuleDirPath)) {
1359
- const path = (0,external_path_.join)(nodeModuleDirPath, basename);
1360
- if (external_fs_.lstatSync(path).isSymbolicLink()) {
1361
- if (basename.startsWith("@")) {
1362
- return undefined;
1363
- }
1364
- if (!getIsLinkedByGarronejScript(path)) {
1365
- return undefined;
1366
- }
1367
- linkedModuleNames.push(basename);
1368
- continue;
1369
- }
1370
- if (!external_fs_.lstatSync(path).isDirectory()) {
1371
- continue;
1372
- }
1373
- if (basename.startsWith("@")) {
1374
- for (const subBasename of external_fs_.readdirSync(path)) {
1375
- const subPath = (0,external_path_.join)(path, subBasename);
1376
- if (!external_fs_.lstatSync(subPath).isSymbolicLink()) {
1377
- continue;
1378
- }
1379
- if (!getIsLinkedByGarronejScript(subPath)) {
1380
- return undefined;
1381
- }
1382
- linkedModuleNames.push(`${basename}/${subBasename}`);
1383
- }
1384
- }
1385
- }
1386
- if (yarnHomeDirPath === undefined) {
1387
- return undefined;
1388
- }
1389
- return { linkedModuleNames, yarnHomeDirPath };
1390
- }
1391
- async function installWithoutBreakingLinks(params) {
1392
- const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
1393
- const parsedPackageJson = (() => {
1394
- const packageJsonFilePath = (0,external_path_.join)(packageJsonDirPath, "package.json");
1395
- const zParsedPackageJson = (() => {
1396
- const zTargetType = lib.z.object({
1397
- scripts: lib.z.record(lib.z.string()).optional()
1398
- });
1399
- assert/* assert */.h;
1400
- return (0,id.id)(zTargetType);
1401
- })();
1402
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
1403
- zParsedPackageJson.parse(parsedPackageJson);
1404
- (0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
1405
- return parsedPackageJson;
1406
- })();
1407
- const isImplementedScriptByName = {
1408
- postinstall: false,
1409
- prepare: false
1410
- };
1411
- delete_postinstall_script: {
1412
- if (parsedPackageJson.scripts === undefined) {
1413
- break delete_postinstall_script;
1414
- }
1415
- for (const scriptName of objectKeys(isImplementedScriptByName)) {
1416
- if (parsedPackageJson.scripts[scriptName] === undefined) {
1417
- continue;
1418
- }
1419
- isImplementedScriptByName[scriptName] = true;
1420
- delete parsedPackageJson.scripts[scriptName];
1421
- }
1422
- }
1423
- const tmpProjectDirPath = (0,external_path_.join)(yarnHomeDirPath, "tmpProject");
1424
- if (external_fs_.existsSync(tmpProjectDirPath)) {
1425
- (0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
1426
- }
1427
- external_fs_.mkdirSync(tmpProjectDirPath, { recursive: true });
1428
- external_fs_.writeFileSync((0,external_path_.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
1429
- const YARN_LOCK = "yarn.lock";
1430
- external_fs_.copyFileSync((0,external_path_.join)(packageJsonDirPath, YARN_LOCK), (0,external_path_.join)(tmpProjectDirPath, YARN_LOCK));
1431
- await runPackageManagerInstall({
1432
- packageManagerBinName: "yarn",
1433
- cwd: tmpProjectDirPath
1434
- });
1435
- // NOTE: Moving the modules from the tmp project to the actual project
1436
- // without messing up the links.
1437
- {
1438
- const { getAreSameVersions } = (() => {
1439
- const zParsedPackageJson = (() => {
1440
- const zTargetType = lib.z.object({
1441
- version: lib.z.string()
1442
- });
1443
- assert/* assert */.h;
1444
- return (0,id.id)(zTargetType);
1445
- })();
1446
- function readVersion(params) {
1447
- const { moduleDirPath } = params;
1448
- const packageJsonFilePath = (0,external_path_.join)(moduleDirPath, "package.json");
1449
- const packageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
1450
- zParsedPackageJson.parse(packageJson);
1451
- (0,assert/* assert */.h)((0,assert.is)(packageJson));
1452
- return packageJson.version;
1453
- }
1454
- function getAreSameVersions(params) {
1455
- const { moduleDirPath_a, moduleDirPath_b } = params;
1456
- return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
1457
- readVersion({ moduleDirPath: moduleDirPath_b }));
1458
- }
1459
- return { getAreSameVersions };
1460
- })();
1461
- const nodeModulesDirPath_tmpProject = (0,external_path_.join)(tmpProjectDirPath, "node_modules");
1462
- const nodeModulesDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
1463
- const modulePaths = external_fs_.readdirSync(nodeModulesDirPath_tmpProject)
1464
- .map(basename => {
1465
- if (basename.startsWith(".")) {
1466
- return undefined;
1467
- }
1468
- const path = (0,external_path_.join)(nodeModulesDirPath_tmpProject, basename);
1469
- if (basename.startsWith("@")) {
1470
- return external_fs_.readdirSync(path)
1471
- .map(subBasename => {
1472
- if (subBasename.startsWith(".")) {
1473
- return undefined;
1474
- }
1475
- const subPath = (0,external_path_.join)(path, subBasename);
1476
- if (!external_fs_.lstatSync(subPath).isDirectory()) {
1477
- return undefined;
1478
- }
1479
- return {
1480
- moduleName: `${basename}/${subBasename}`,
1481
- moduleDirPath_tmpProject: subPath,
1482
- moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename, subBasename)
1483
- };
1484
- })
1485
- .filter((0,exclude/* exclude */.D)(undefined));
1486
- }
1487
- if (!external_fs_.lstatSync(path).isDirectory()) {
1488
- return undefined;
1489
- }
1490
- return [
1491
- {
1492
- moduleName: basename,
1493
- moduleDirPath_tmpProject: path,
1494
- moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename)
1495
- }
1496
- ];
1497
- })
1498
- .filter((0,exclude/* exclude */.D)(undefined))
1499
- .flat();
1500
- for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
1501
- if (linkedModuleNames.includes(moduleName)) {
1502
- continue;
1503
- }
1504
- let doesTargetModuleExist = false;
1505
- skip_condition: {
1506
- if (!external_fs_.existsSync(moduleDirPath)) {
1507
- break skip_condition;
1508
- }
1509
- doesTargetModuleExist = true;
1510
- const areSameVersions = getAreSameVersions({
1511
- moduleDirPath_a: moduleDirPath,
1512
- moduleDirPath_b: moduleDirPath_tmpProject
1513
- });
1514
- if (!areSameVersions) {
1515
- break skip_condition;
1516
- }
1517
- continue;
1518
- }
1519
- if (doesTargetModuleExist) {
1520
- (0,fs_rmSync/* rmSync */.a)(moduleDirPath, { recursive: true });
1521
- }
1522
- {
1523
- const dirPath = (0,external_path_.dirname)(moduleDirPath);
1524
- if (!external_fs_.existsSync(dirPath)) {
1525
- external_fs_.mkdirSync(dirPath, { recursive: true });
1526
- }
1527
- }
1528
- external_fs_.renameSync(moduleDirPath_tmpProject, moduleDirPath);
1529
- }
1530
- move_bin: {
1531
- const binDirPath_tmpProject = (0,external_path_.join)(nodeModulesDirPath_tmpProject, ".bin");
1532
- const binDirPath = (0,external_path_.join)(nodeModulesDirPath, ".bin");
1533
- if (!external_fs_.existsSync(binDirPath_tmpProject)) {
1534
- break move_bin;
1535
- }
1536
- for (const basename of external_fs_.readdirSync(binDirPath_tmpProject)) {
1537
- const path_tmpProject = (0,external_path_.join)(binDirPath_tmpProject, basename);
1538
- const path = (0,external_path_.join)(binDirPath, basename);
1539
- if (external_fs_.existsSync(path)) {
1540
- continue;
1541
- }
1542
- external_fs_.renameSync(path_tmpProject, path);
1543
- }
1544
- }
1545
- }
1546
- external_fs_.cpSync((0,external_path_.join)(tmpProjectDirPath, YARN_LOCK), (0,external_path_.join)(packageJsonDirPath, YARN_LOCK));
1547
- (0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
1548
- for (const scriptName of objectKeys(isImplementedScriptByName)) {
1549
- if (!isImplementedScriptByName[scriptName]) {
1550
- continue;
1551
- }
1552
- external_child_process_.execSync(`yarn run ${scriptName}`, {
1553
- cwd: packageJsonDirPath,
1554
- stdio: "inherit"
1555
- });
1556
- }
1557
- }
1558
- //# sourceMappingURL=npmInstall.js.map
1559
-
1560
- /***/ }),
1561
-
1562
- /***/ 48433:
1563
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
1564
-
1565
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1566
- /* harmony export */ "LG": () => (/* binding */ getPrettier),
1567
- /* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
1568
- /* harmony export */ "eY": () => (/* binding */ runPrettier)
1569
- /* harmony export */ });
1570
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73776);
1571
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
1572
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1573
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
1574
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
1575
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
1576
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
1577
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
1578
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
1579
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
1580
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
1581
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
1582
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
1583
- /* module decorator */ module = __webpack_require__.hmd(module);
1584
-
1585
-
1586
-
1587
-
1588
-
1589
-
1590
-
1591
-
1592
-
1593
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
1594
- async function getIsPrettierAvailable() {
1595
- var _a;
1596
- if (getIsPrettierAvailable.cache !== undefined) {
1597
- return getIsPrettierAvailable.cache;
1598
- }
1599
- const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({
1600
- packageJsonFilePath: undefined
1601
- });
1602
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
1603
- const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
1604
- const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
1605
- getIsPrettierAvailable.cache = isPrettierAvailable;
1606
- return isPrettierAvailable;
1607
- }
1608
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
1609
- async function getPrettier() {
1610
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
1611
- if (getPrettier.cache !== undefined) {
1612
- return getPrettier.cache;
1613
- }
1614
- let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
1615
- import_prettier: {
1616
- // NOTE: When module is linked we want to make sure we import the correct version
1617
- // of prettier, that is the one of the project, not the one of this repo.
1618
- // So we do a sketchy eval to bypass ncc.
1619
- // We make sure to only do that when linking, otherwise we import properly.
1620
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
1621
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", "prettier"));
1622
- const isCJS = true && module.exports;
1623
- if (isCJS) {
1624
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${prettierDirPath}")`);
1625
- }
1626
- else {
1627
- prettier = await new Promise(_resolve => {
1628
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_1__.join)(prettierDirPath, "index.mjs").replace(/\\/g, "/")}").then(prettier => _resolve(prettier))`);
1629
- });
1630
- }
1631
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
1632
- break import_prettier;
1633
- }
1634
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
1635
- }
1636
- const configHash = await (async () => {
1637
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", ".."));
1638
- if (configFilePath === null) {
1639
- return "";
1640
- }
1641
- const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
1642
- return crypto__WEBPACK_IMPORTED_MODULE_5__.createHash("sha256").update(data).digest("hex");
1643
- })();
1644
- const prettierAndConfig = {
1645
- prettier,
1646
- configHash
1647
- };
1648
- getPrettier.cache = prettierAndConfig;
1649
- return prettierAndConfig;
1650
- }
1651
- async function runPrettier(params) {
1652
- const { sourceCode, filePath } = params;
1653
- let formattedSourceCode;
1654
- try {
1655
- const { prettier } = await getPrettier();
1656
- const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
1657
- resolveConfig: true
1658
- });
1659
- if (ignored || inferredParser === null) {
1660
- return sourceCode;
1661
- }
1662
- const config = await prettier.resolveConfig(filePath);
1663
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
1664
- }
1665
- catch (error) {
1666
- console.log(chalk__WEBPACK_IMPORTED_MODULE_4___default().red(`You probably need to upgrade the version of prettier in your project`));
1667
- throw error;
1668
- }
1669
- return formattedSourceCode;
1670
- }
1671
- //# sourceMappingURL=runPrettier.js.map
1672
-
1673
- /***/ })
1674
-
1675
- };
1676
- ;