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