keycloakify 11.8.33 → 11.8.35-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{355.index.js → 313.index.js} +145 -255
- package/bin/{932.index.js → 618.index.js} +163 -115
- package/bin/698.index.js +298 -0
- package/bin/780.index.js +10 -294
- package/bin/{502.index.js → 84.index.js} +99 -147
- package/bin/97.index.js +224 -589
- package/bin/main.js +15362 -15338
- package/package.json +5 -5
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +10 -16
- package/src/bin/initialize-admin-theme.ts +0 -13
- package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +16 -0
- package/src/bin/sync-extensions/sync-extension.ts +8 -0
- package/bin/656.index.js +0 -119
package/bin/97.index.js
CHANGED
@@ -3,6 +3,81 @@ exports.id = 97;
|
|
3
3
|
exports.ids = [97];
|
4
4
|
exports.modules = {
|
5
5
|
|
6
|
+
/***/ 72138:
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8
|
+
|
9
|
+
|
10
|
+
// EXPORTS
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
12
|
+
"q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
|
13
|
+
});
|
14
|
+
|
15
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
16
|
+
var esm_assert = __webpack_require__(29041);
|
17
|
+
// EXTERNAL MODULE: ./dist/bin/shared/constants.js
|
18
|
+
var constants = __webpack_require__(173);
|
19
|
+
;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
|
20
|
+
|
21
|
+
|
22
|
+
const BIN_NAME = "_keycloakify-custom-handler";
|
23
|
+
const NOT_IMPLEMENTED_EXIT_CODE = 78;
|
24
|
+
function readParams(params) {
|
25
|
+
const { apiVersion } = params;
|
26
|
+
assert(apiVersion === "v1");
|
27
|
+
const commandName = (() => {
|
28
|
+
const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
|
29
|
+
assert(envValue !== undefined);
|
30
|
+
return envValue;
|
31
|
+
})();
|
32
|
+
const buildContext = (() => {
|
33
|
+
const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
|
34
|
+
assert(envValue !== undefined);
|
35
|
+
return JSON.parse(envValue);
|
36
|
+
})();
|
37
|
+
return { commandName, buildContext };
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=customHandler.js.map
|
40
|
+
// EXTERNAL MODULE: external "child_process"
|
41
|
+
var external_child_process_ = __webpack_require__(32081);
|
42
|
+
// EXTERNAL MODULE: ./dist/bin/tools/nodeModulesBinDirPath.js
|
43
|
+
var tools_nodeModulesBinDirPath = __webpack_require__(73776);
|
44
|
+
// EXTERNAL MODULE: external "fs"
|
45
|
+
var external_fs_ = __webpack_require__(57147);
|
46
|
+
;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
(0,esm_assert/* assert */.h)();
|
54
|
+
async function maybeDelegateCommandToCustomHandler(params) {
|
55
|
+
const { commandName, buildContext } = params;
|
56
|
+
const nodeModulesBinDirPath = await (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)({
|
57
|
+
packageJsonFilePath: buildContext.packageJsonFilePath
|
58
|
+
});
|
59
|
+
if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
|
60
|
+
return { hasBeenHandled: false };
|
61
|
+
}
|
62
|
+
try {
|
63
|
+
external_child_process_.execSync(`npx ${BIN_NAME}`, {
|
64
|
+
stdio: "inherit",
|
65
|
+
env: Object.assign(Object.assign({}, process.env), { [constants/* CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME */._S.COMMAND_NAME]: commandName, [constants/* CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT */._S.BUILD_CONTEXT]: JSON.stringify(buildContext) })
|
66
|
+
});
|
67
|
+
}
|
68
|
+
catch (error) {
|
69
|
+
const status = error.status;
|
70
|
+
if (status === NOT_IMPLEMENTED_EXIT_CODE) {
|
71
|
+
return { hasBeenHandled: false };
|
72
|
+
}
|
73
|
+
process.exit(status);
|
74
|
+
}
|
75
|
+
return { hasBeenHandled: true };
|
76
|
+
}
|
77
|
+
//# sourceMappingURL=customHandler_delegate.js.map
|
78
|
+
|
79
|
+
/***/ }),
|
80
|
+
|
6
81
|
/***/ 77372:
|
7
82
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8
83
|
|
@@ -303,6 +378,18 @@ function computeHash(data) {
|
|
303
378
|
async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
304
379
|
const { buildContext, extensionModuleDirPath, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
|
305
380
|
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");
|
381
|
+
add_eslint_disable: {
|
382
|
+
if (isOwnershipAction) {
|
383
|
+
break add_eslint_disable;
|
384
|
+
}
|
385
|
+
if (!fileRelativePath.endsWith(".ts") && !fileRelativePath.endsWith(".tsx")) {
|
386
|
+
break add_eslint_disable;
|
387
|
+
}
|
388
|
+
if (sourceCode.includes("/* eslint-disable */")) {
|
389
|
+
break add_eslint_disable;
|
390
|
+
}
|
391
|
+
sourceCode = ["/* eslint-disable */", "", sourceCode].join("\n");
|
392
|
+
}
|
306
393
|
sourceCode = addCommentToSourceCode({
|
307
394
|
sourceCode,
|
308
395
|
fileRelativePath,
|
@@ -674,6 +761,10 @@ const untrackFromGit = runExclusive.build(groupRef, async (params) => {
|
|
674
761
|
await dDone.pr;
|
675
762
|
});
|
676
763
|
//# sourceMappingURL=gitUtils.js.map
|
764
|
+
// EXTERNAL MODULE: ./dist/bin/update-kc-gen.js
|
765
|
+
var update_kc_gen = __webpack_require__(10786);
|
766
|
+
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 3 modules
|
767
|
+
var shared_buildContext = __webpack_require__(85400);
|
677
768
|
;// CONCATENATED MODULE: ./dist/bin/sync-extensions/sync-extension.js
|
678
769
|
|
679
770
|
|
@@ -683,6 +774,8 @@ const untrackFromGit = runExclusive.build(groupRef, async (params) => {
|
|
683
774
|
|
684
775
|
|
685
776
|
|
777
|
+
|
778
|
+
|
686
779
|
async function command(params) {
|
687
780
|
const { buildContext } = params;
|
688
781
|
const extensionModuleMetas = await (0,sync_extensions_extensionModuleMeta/* getExtensionModuleMetas */.f)({ buildContext });
|
@@ -729,96 +822,16 @@ async function command(params) {
|
|
729
822
|
await promises_.copyFile(copyableFilePath, destFilePath);
|
730
823
|
})))
|
731
824
|
.flat());
|
825
|
+
await (0,update_kc_gen.command)({
|
826
|
+
buildContext: (0,shared_buildContext/* getBuildContext */.s)({
|
827
|
+
projectDirPath: buildContext.projectDirPath
|
828
|
+
})
|
829
|
+
});
|
732
830
|
}
|
733
831
|
//# sourceMappingURL=sync-extension.js.map
|
734
832
|
|
735
833
|
/***/ }),
|
736
834
|
|
737
|
-
/***/ 12171:
|
738
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
739
|
-
|
740
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
741
|
-
/* harmony export */ "h": () => (/* binding */ SemVer)
|
742
|
-
/* harmony export */ });
|
743
|
-
var SemVer;
|
744
|
-
(function (SemVer) {
|
745
|
-
const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
|
746
|
-
function parse(versionStr) {
|
747
|
-
const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
|
748
|
-
if (!match) {
|
749
|
-
throw new Error(`${versionStr} is not a valid semantic version`);
|
750
|
-
}
|
751
|
-
const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
|
752
|
-
const str = match[3];
|
753
|
-
return str === undefined ? 0 : parseInt(str);
|
754
|
-
})() }, (() => {
|
755
|
-
const str = match[4];
|
756
|
-
return str === undefined ? {} : { rc: parseInt(str) };
|
757
|
-
})());
|
758
|
-
const initialStr = stringify(semVer);
|
759
|
-
Object.defineProperty(semVer, "parsedFrom", {
|
760
|
-
enumerable: true,
|
761
|
-
get: function () {
|
762
|
-
const currentStr = stringify(this);
|
763
|
-
if (currentStr !== initialStr) {
|
764
|
-
throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
|
765
|
-
}
|
766
|
-
return versionStr;
|
767
|
-
}
|
768
|
-
});
|
769
|
-
return semVer;
|
770
|
-
}
|
771
|
-
SemVer.parse = parse;
|
772
|
-
function stringify(v) {
|
773
|
-
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
|
774
|
-
}
|
775
|
-
SemVer.stringify = stringify;
|
776
|
-
/**
|
777
|
-
*
|
778
|
-
* v1 < v2 => -1
|
779
|
-
* v1 === v2 => 0
|
780
|
-
* v1 > v2 => 1
|
781
|
-
*
|
782
|
-
*/
|
783
|
-
function compare(v1, v2) {
|
784
|
-
const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
|
785
|
-
const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
|
786
|
-
for (const level of ["major", "minor", "patch", "rc"]) {
|
787
|
-
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
|
788
|
-
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
|
789
|
-
}
|
790
|
-
}
|
791
|
-
return 0;
|
792
|
-
}
|
793
|
-
SemVer.compare = compare;
|
794
|
-
/*
|
795
|
-
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
|
796
|
-
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
|
797
|
-
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
|
798
|
-
*/
|
799
|
-
function bumpType(params) {
|
800
|
-
const versionAhead = typeof params.versionAhead === "string"
|
801
|
-
? parse(params.versionAhead)
|
802
|
-
: params.versionAhead;
|
803
|
-
const versionBehind = typeof params.versionBehind === "string"
|
804
|
-
? parse(params.versionBehind)
|
805
|
-
: params.versionBehind;
|
806
|
-
if (compare(versionBehind, versionAhead) === 1) {
|
807
|
-
throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
|
808
|
-
}
|
809
|
-
for (const level of ["major", "minor", "patch", "rc"]) {
|
810
|
-
if (versionBehind[level] !== versionAhead[level]) {
|
811
|
-
return level;
|
812
|
-
}
|
813
|
-
}
|
814
|
-
return "no bump";
|
815
|
-
}
|
816
|
-
SemVer.bumpType = bumpType;
|
817
|
-
})(SemVer || (SemVer = {}));
|
818
|
-
//# sourceMappingURL=SemVer.js.map
|
819
|
-
|
820
|
-
/***/ }),
|
821
|
-
|
822
835
|
/***/ 43765:
|
823
836
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
824
837
|
|
@@ -843,49 +856,6 @@ async function existsAsync(path) {
|
|
843
856
|
|
844
857
|
/***/ }),
|
845
858
|
|
846
|
-
/***/ 89693:
|
847
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
848
|
-
|
849
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
850
|
-
/* harmony export */ "a": () => (/* binding */ rmSync)
|
851
|
-
/* harmony export */ });
|
852
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
|
853
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
854
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
|
855
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
856
|
-
/* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
/**
|
861
|
-
* Polyfill of fs.rmSync(dirPath, { "recursive": true })
|
862
|
-
* For older version of Node
|
863
|
-
*/
|
864
|
-
function rmSync(dirPath, options) {
|
865
|
-
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) {
|
866
|
-
fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
|
867
|
-
return;
|
868
|
-
}
|
869
|
-
const { force = true } = options;
|
870
|
-
if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
|
871
|
-
return;
|
872
|
-
}
|
873
|
-
const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
|
874
|
-
const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
|
875
|
-
if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
|
876
|
-
removeDir_rec(fileOrDirPath);
|
877
|
-
return;
|
878
|
-
}
|
879
|
-
else {
|
880
|
-
fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
|
881
|
-
}
|
882
|
-
});
|
883
|
-
removeDir_rec(dirPath);
|
884
|
-
}
|
885
|
-
//# sourceMappingURL=fs.rmSync.js.map
|
886
|
-
|
887
|
-
/***/ }),
|
888
|
-
|
889
859
|
/***/ 93721:
|
890
860
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
891
861
|
|
@@ -1184,489 +1154,154 @@ function getNodeModulesBinDirPath(params) {
|
|
1184
1154
|
|
1185
1155
|
/***/ }),
|
1186
1156
|
|
1187
|
-
/***/
|
1157
|
+
/***/ 10786:
|
1188
1158
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
1189
1159
|
|
1190
|
-
|
1191
|
-
// EXPORTS
|
1192
|
-
__webpack_require__.d(__webpack_exports__, {
|
1193
|
-
"c": () => (/* binding */ npmInstall)
|
1194
|
-
});
|
1195
|
-
|
1196
|
-
// EXTERNAL MODULE: external "fs"
|
1197
|
-
var external_fs_ = __webpack_require__(57147);
|
1198
|
-
// EXTERNAL MODULE: external "path"
|
1199
|
-
var external_path_ = __webpack_require__(71017);
|
1200
|
-
// EXTERNAL MODULE: external "child_process"
|
1201
|
-
var external_child_process_ = __webpack_require__(32081);
|
1202
|
-
// EXTERNAL MODULE: ./node_modules/chalk/source/index.js
|
1203
|
-
var source = __webpack_require__(78818);
|
1204
|
-
var source_default = /*#__PURE__*/__webpack_require__.n(source);
|
1205
|
-
// EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
|
1206
|
-
var lib = __webpack_require__(52300);
|
1207
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
1208
|
-
var assert = __webpack_require__(29041);
|
1209
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
1210
|
-
var id = __webpack_require__(38469);
|
1211
|
-
;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
|
1212
|
-
/** https://docs.tsafe.dev/objectKeys */
|
1213
|
-
function objectKeys(o) {
|
1214
|
-
return Object.keys(o);
|
1215
|
-
}
|
1216
|
-
|
1217
|
-
|
1218
|
-
//# sourceMappingURL=objectKeys.mjs.map
|
1219
|
-
|
1220
|
-
// EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
|
1221
|
-
var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
|
1222
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
|
1223
|
-
var exclude = __webpack_require__(83101);
|
1224
|
-
// EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
|
1225
|
-
var fs_rmSync = __webpack_require__(89693);
|
1226
|
-
// EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
|
1227
|
-
var Deferred = __webpack_require__(50689);
|
1228
|
-
;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
async function npmInstall(params) {
|
1242
|
-
const { packageJsonDirPath } = params;
|
1243
|
-
const packageManagerBinName = (() => {
|
1244
|
-
const packageMangers = [
|
1245
|
-
{
|
1246
|
-
binName: "yarn",
|
1247
|
-
lockFileBasename: "yarn.lock"
|
1248
|
-
},
|
1249
|
-
{
|
1250
|
-
binName: "npm",
|
1251
|
-
lockFileBasename: "package-lock.json"
|
1252
|
-
},
|
1253
|
-
{
|
1254
|
-
binName: "pnpm",
|
1255
|
-
lockFileBasename: "pnpm-lock.yaml"
|
1256
|
-
},
|
1257
|
-
{
|
1258
|
-
binName: "bun",
|
1259
|
-
lockFileBasename: "bun.lockdb"
|
1260
|
-
},
|
1261
|
-
{
|
1262
|
-
binName: "deno",
|
1263
|
-
lockFileBasename: "deno.lock"
|
1264
|
-
}
|
1265
|
-
];
|
1266
|
-
for (const packageManager of packageMangers) {
|
1267
|
-
if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
|
1268
|
-
external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
|
1269
|
-
return packageManager.binName;
|
1270
|
-
}
|
1271
|
-
}
|
1272
|
-
throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
|
1273
|
-
})();
|
1274
|
-
console.log(`Installing the new dependencies...`);
|
1275
|
-
install_without_breaking_links: {
|
1276
|
-
if (packageManagerBinName !== "yarn") {
|
1277
|
-
break install_without_breaking_links;
|
1278
|
-
}
|
1279
|
-
const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
|
1280
|
-
if (garronejLinkInfos === undefined) {
|
1281
|
-
break install_without_breaking_links;
|
1282
|
-
}
|
1283
|
-
console.log(source_default().green("Installing in a way that won't break the links..."));
|
1284
|
-
await installWithoutBreakingLinks({
|
1285
|
-
packageJsonDirPath,
|
1286
|
-
garronejLinkInfos
|
1287
|
-
});
|
1288
|
-
return;
|
1289
|
-
}
|
1290
|
-
try {
|
1291
|
-
await runPackageManagerInstall({
|
1292
|
-
packageManagerBinName,
|
1293
|
-
cwd: packageJsonDirPath
|
1294
|
-
});
|
1295
|
-
}
|
1296
|
-
catch (_a) {
|
1297
|
-
console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
|
1298
|
-
}
|
1299
|
-
}
|
1300
|
-
async function runPackageManagerInstall(params) {
|
1301
|
-
const { packageManagerBinName, cwd } = params;
|
1302
|
-
const dCompleted = new Deferred.Deferred();
|
1303
|
-
const child = external_child_process_.spawn(packageManagerBinName, ["install"], {
|
1304
|
-
cwd,
|
1305
|
-
env: process.env,
|
1306
|
-
shell: true
|
1307
|
-
});
|
1308
|
-
child.stdout.on("data", data => process.stdout.write(data));
|
1309
|
-
child.stderr.on("data", data => {
|
1310
|
-
if (data.toString("utf8").includes("peer dependency")) {
|
1311
|
-
return;
|
1312
|
-
}
|
1313
|
-
process.stderr.write(data);
|
1314
|
-
});
|
1315
|
-
child.on("exit", code => {
|
1316
|
-
if (code !== 0) {
|
1317
|
-
dCompleted.reject(new Error(`Failed with code ${code}`));
|
1318
|
-
return;
|
1319
|
-
}
|
1320
|
-
dCompleted.resolve();
|
1321
|
-
});
|
1322
|
-
await dCompleted.pr;
|
1323
|
-
}
|
1324
|
-
function getGarronejLinkInfos(params) {
|
1325
|
-
const { packageJsonDirPath } = params;
|
1326
|
-
const nodeModuleDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
1327
|
-
if (!external_fs_.existsSync(nodeModuleDirPath)) {
|
1328
|
-
return undefined;
|
1329
|
-
}
|
1330
|
-
const linkedModuleNames = [];
|
1331
|
-
let yarnHomeDirPath = undefined;
|
1332
|
-
const getIsLinkedByGarronejScript = (path) => {
|
1333
|
-
let realPath;
|
1334
|
-
try {
|
1335
|
-
realPath = external_fs_.readlinkSync(path);
|
1336
|
-
}
|
1337
|
-
catch (_a) {
|
1338
|
-
return false;
|
1339
|
-
}
|
1340
|
-
const doesIncludeYarnHome = realPath.includes(".yarn_home");
|
1341
|
-
if (!doesIncludeYarnHome) {
|
1342
|
-
return false;
|
1343
|
-
}
|
1344
|
-
set_yarnHomeDirPath: {
|
1345
|
-
if (yarnHomeDirPath !== undefined) {
|
1346
|
-
break set_yarnHomeDirPath;
|
1347
|
-
}
|
1348
|
-
const [firstElement] = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
1349
|
-
pathIsh: realPath,
|
1350
|
-
cwd: (0,external_path_.dirname)(path)
|
1351
|
-
}).split(".yarn_home");
|
1352
|
-
yarnHomeDirPath = (0,external_path_.join)(firstElement, ".yarn_home");
|
1353
|
-
}
|
1354
|
-
return true;
|
1355
|
-
};
|
1356
|
-
for (const basename of external_fs_.readdirSync(nodeModuleDirPath)) {
|
1357
|
-
const path = (0,external_path_.join)(nodeModuleDirPath, basename);
|
1358
|
-
if (external_fs_.lstatSync(path).isSymbolicLink()) {
|
1359
|
-
if (basename.startsWith("@")) {
|
1360
|
-
return undefined;
|
1361
|
-
}
|
1362
|
-
if (!getIsLinkedByGarronejScript(path)) {
|
1363
|
-
return undefined;
|
1364
|
-
}
|
1365
|
-
linkedModuleNames.push(basename);
|
1366
|
-
continue;
|
1367
|
-
}
|
1368
|
-
if (!external_fs_.lstatSync(path).isDirectory()) {
|
1369
|
-
continue;
|
1370
|
-
}
|
1371
|
-
if (basename.startsWith("@")) {
|
1372
|
-
for (const subBasename of external_fs_.readdirSync(path)) {
|
1373
|
-
const subPath = (0,external_path_.join)(path, subBasename);
|
1374
|
-
if (!external_fs_.lstatSync(subPath).isSymbolicLink()) {
|
1375
|
-
continue;
|
1376
|
-
}
|
1377
|
-
if (!getIsLinkedByGarronejScript(subPath)) {
|
1378
|
-
return undefined;
|
1379
|
-
}
|
1380
|
-
linkedModuleNames.push(`${basename}/${subBasename}`);
|
1381
|
-
}
|
1382
|
-
}
|
1383
|
-
}
|
1384
|
-
if (yarnHomeDirPath === undefined) {
|
1385
|
-
return undefined;
|
1386
|
-
}
|
1387
|
-
return { linkedModuleNames, yarnHomeDirPath };
|
1388
|
-
}
|
1389
|
-
async function installWithoutBreakingLinks(params) {
|
1390
|
-
const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
|
1391
|
-
const parsedPackageJson = (() => {
|
1392
|
-
const packageJsonFilePath = (0,external_path_.join)(packageJsonDirPath, "package.json");
|
1393
|
-
const zParsedPackageJson = (() => {
|
1394
|
-
const zTargetType = lib.z.object({
|
1395
|
-
scripts: lib.z.record(lib.z.string()).optional()
|
1396
|
-
});
|
1397
|
-
assert/* assert */.h;
|
1398
|
-
return (0,id.id)(zTargetType);
|
1399
|
-
})();
|
1400
|
-
const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
1401
|
-
zParsedPackageJson.parse(parsedPackageJson);
|
1402
|
-
(0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
|
1403
|
-
return parsedPackageJson;
|
1404
|
-
})();
|
1405
|
-
const isImplementedScriptByName = {
|
1406
|
-
postinstall: false,
|
1407
|
-
prepare: false
|
1408
|
-
};
|
1409
|
-
delete_postinstall_script: {
|
1410
|
-
if (parsedPackageJson.scripts === undefined) {
|
1411
|
-
break delete_postinstall_script;
|
1412
|
-
}
|
1413
|
-
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
1414
|
-
if (parsedPackageJson.scripts[scriptName] === undefined) {
|
1415
|
-
continue;
|
1416
|
-
}
|
1417
|
-
isImplementedScriptByName[scriptName] = true;
|
1418
|
-
delete parsedPackageJson.scripts[scriptName];
|
1419
|
-
}
|
1420
|
-
}
|
1421
|
-
const tmpProjectDirPath = (0,external_path_.join)(yarnHomeDirPath, "tmpProject");
|
1422
|
-
if (external_fs_.existsSync(tmpProjectDirPath)) {
|
1423
|
-
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
1424
|
-
}
|
1425
|
-
external_fs_.mkdirSync(tmpProjectDirPath, { recursive: true });
|
1426
|
-
external_fs_.writeFileSync((0,external_path_.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
|
1427
|
-
const YARN_LOCK = "yarn.lock";
|
1428
|
-
external_fs_.copyFileSync((0,external_path_.join)(packageJsonDirPath, YARN_LOCK), (0,external_path_.join)(tmpProjectDirPath, YARN_LOCK));
|
1429
|
-
await runPackageManagerInstall({
|
1430
|
-
packageManagerBinName: "yarn",
|
1431
|
-
cwd: tmpProjectDirPath
|
1432
|
-
});
|
1433
|
-
// NOTE: Moving the modules from the tmp project to the actual project
|
1434
|
-
// without messing up the links.
|
1435
|
-
{
|
1436
|
-
const { getAreSameVersions } = (() => {
|
1437
|
-
const zParsedPackageJson = (() => {
|
1438
|
-
const zTargetType = lib.z.object({
|
1439
|
-
version: lib.z.string()
|
1440
|
-
});
|
1441
|
-
assert/* assert */.h;
|
1442
|
-
return (0,id.id)(zTargetType);
|
1443
|
-
})();
|
1444
|
-
function readVersion(params) {
|
1445
|
-
const { moduleDirPath } = params;
|
1446
|
-
const packageJsonFilePath = (0,external_path_.join)(moduleDirPath, "package.json");
|
1447
|
-
const packageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
1448
|
-
zParsedPackageJson.parse(packageJson);
|
1449
|
-
(0,assert/* assert */.h)((0,assert.is)(packageJson));
|
1450
|
-
return packageJson.version;
|
1451
|
-
}
|
1452
|
-
function getAreSameVersions(params) {
|
1453
|
-
const { moduleDirPath_a, moduleDirPath_b } = params;
|
1454
|
-
return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
|
1455
|
-
readVersion({ moduleDirPath: moduleDirPath_b }));
|
1456
|
-
}
|
1457
|
-
return { getAreSameVersions };
|
1458
|
-
})();
|
1459
|
-
const nodeModulesDirPath_tmpProject = (0,external_path_.join)(tmpProjectDirPath, "node_modules");
|
1460
|
-
const nodeModulesDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
1461
|
-
const modulePaths = external_fs_.readdirSync(nodeModulesDirPath_tmpProject)
|
1462
|
-
.map(basename => {
|
1463
|
-
if (basename.startsWith(".")) {
|
1464
|
-
return undefined;
|
1465
|
-
}
|
1466
|
-
const path = (0,external_path_.join)(nodeModulesDirPath_tmpProject, basename);
|
1467
|
-
if (basename.startsWith("@")) {
|
1468
|
-
return external_fs_.readdirSync(path)
|
1469
|
-
.map(subBasename => {
|
1470
|
-
if (subBasename.startsWith(".")) {
|
1471
|
-
return undefined;
|
1472
|
-
}
|
1473
|
-
const subPath = (0,external_path_.join)(path, subBasename);
|
1474
|
-
if (!external_fs_.lstatSync(subPath).isDirectory()) {
|
1475
|
-
return undefined;
|
1476
|
-
}
|
1477
|
-
return {
|
1478
|
-
moduleName: `${basename}/${subBasename}`,
|
1479
|
-
moduleDirPath_tmpProject: subPath,
|
1480
|
-
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename, subBasename)
|
1481
|
-
};
|
1482
|
-
})
|
1483
|
-
.filter((0,exclude/* exclude */.D)(undefined));
|
1484
|
-
}
|
1485
|
-
if (!external_fs_.lstatSync(path).isDirectory()) {
|
1486
|
-
return undefined;
|
1487
|
-
}
|
1488
|
-
return [
|
1489
|
-
{
|
1490
|
-
moduleName: basename,
|
1491
|
-
moduleDirPath_tmpProject: path,
|
1492
|
-
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename)
|
1493
|
-
}
|
1494
|
-
];
|
1495
|
-
})
|
1496
|
-
.filter((0,exclude/* exclude */.D)(undefined))
|
1497
|
-
.flat();
|
1498
|
-
for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
|
1499
|
-
if (linkedModuleNames.includes(moduleName)) {
|
1500
|
-
continue;
|
1501
|
-
}
|
1502
|
-
let doesTargetModuleExist = false;
|
1503
|
-
skip_condition: {
|
1504
|
-
if (!external_fs_.existsSync(moduleDirPath)) {
|
1505
|
-
break skip_condition;
|
1506
|
-
}
|
1507
|
-
doesTargetModuleExist = true;
|
1508
|
-
const areSameVersions = getAreSameVersions({
|
1509
|
-
moduleDirPath_a: moduleDirPath,
|
1510
|
-
moduleDirPath_b: moduleDirPath_tmpProject
|
1511
|
-
});
|
1512
|
-
if (!areSameVersions) {
|
1513
|
-
break skip_condition;
|
1514
|
-
}
|
1515
|
-
continue;
|
1516
|
-
}
|
1517
|
-
if (doesTargetModuleExist) {
|
1518
|
-
(0,fs_rmSync/* rmSync */.a)(moduleDirPath, { recursive: true });
|
1519
|
-
}
|
1520
|
-
{
|
1521
|
-
const dirPath = (0,external_path_.dirname)(moduleDirPath);
|
1522
|
-
if (!external_fs_.existsSync(dirPath)) {
|
1523
|
-
external_fs_.mkdirSync(dirPath, { recursive: true });
|
1524
|
-
}
|
1525
|
-
}
|
1526
|
-
external_fs_.renameSync(moduleDirPath_tmpProject, moduleDirPath);
|
1527
|
-
}
|
1528
|
-
move_bin: {
|
1529
|
-
const binDirPath_tmpProject = (0,external_path_.join)(nodeModulesDirPath_tmpProject, ".bin");
|
1530
|
-
const binDirPath = (0,external_path_.join)(nodeModulesDirPath, ".bin");
|
1531
|
-
if (!external_fs_.existsSync(binDirPath_tmpProject)) {
|
1532
|
-
break move_bin;
|
1533
|
-
}
|
1534
|
-
for (const basename of external_fs_.readdirSync(binDirPath_tmpProject)) {
|
1535
|
-
const path_tmpProject = (0,external_path_.join)(binDirPath_tmpProject, basename);
|
1536
|
-
const path = (0,external_path_.join)(binDirPath, basename);
|
1537
|
-
if (external_fs_.existsSync(path)) {
|
1538
|
-
continue;
|
1539
|
-
}
|
1540
|
-
external_fs_.renameSync(path_tmpProject, path);
|
1541
|
-
}
|
1542
|
-
}
|
1543
|
-
}
|
1544
|
-
external_fs_.cpSync((0,external_path_.join)(tmpProjectDirPath, YARN_LOCK), (0,external_path_.join)(packageJsonDirPath, YARN_LOCK));
|
1545
|
-
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
1546
|
-
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
1547
|
-
if (!isImplementedScriptByName[scriptName]) {
|
1548
|
-
continue;
|
1549
|
-
}
|
1550
|
-
external_child_process_.execSync(`yarn run ${scriptName}`, {
|
1551
|
-
cwd: packageJsonDirPath,
|
1552
|
-
stdio: "inherit"
|
1553
|
-
});
|
1554
|
-
}
|
1555
|
-
}
|
1556
|
-
//# sourceMappingURL=npmInstall.js.map
|
1557
|
-
|
1558
|
-
/***/ }),
|
1559
|
-
|
1560
|
-
/***/ 48433:
|
1561
|
-
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
1562
|
-
|
1160
|
+
__webpack_require__.r(__webpack_exports__);
|
1563
1161
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
1564
|
-
/* harmony export */ "
|
1565
|
-
/* harmony export */ "MT": () => (/* binding */ getIsPrettierAvailable),
|
1566
|
-
/* harmony export */ "eY": () => (/* binding */ runPrettier)
|
1162
|
+
/* harmony export */ "command": () => (/* binding */ command)
|
1567
1163
|
/* harmony export */ });
|
1568
|
-
/* harmony import */ var
|
1164
|
+
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
|
1165
|
+
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
|
1569
1166
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
|
1570
1167
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
1571
|
-
/* harmony import */ var
|
1572
|
-
/* harmony import */ var
|
1573
|
-
/* harmony import */ var
|
1574
|
-
/* harmony import */ var
|
1575
|
-
/* harmony import */ var
|
1576
|
-
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
|
1577
|
-
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
|
1578
|
-
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
|
1579
|
-
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76030);
|
1580
|
-
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64795);
|
1581
|
-
/* module decorator */ module = __webpack_require__.hmd(module);
|
1168
|
+
/* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43765);
|
1169
|
+
/* harmony import */ var _shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72138);
|
1170
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6113);
|
1171
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_4__);
|
1172
|
+
/* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48433);
|
1582
1173
|
|
1583
1174
|
|
1584
1175
|
|
1585
1176
|
|
1586
1177
|
|
1587
1178
|
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1179
|
+
async function command(params) {
|
1180
|
+
const { buildContext } = params;
|
1181
|
+
run_copy_assets_to_public: {
|
1182
|
+
if (buildContext.bundler !== "webpack") {
|
1183
|
+
break run_copy_assets_to_public;
|
1184
|
+
}
|
1185
|
+
const { command } = await __webpack_require__.e(/* import() */ 658).then(__webpack_require__.bind(__webpack_require__, 18040));
|
1186
|
+
await command({ buildContext });
|
1596
1187
|
}
|
1597
|
-
const
|
1598
|
-
|
1188
|
+
const { hasBeenHandled } = await (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_3__/* .maybeDelegateCommandToCustomHandler */ .q)({
|
1189
|
+
commandName: "update-kc-gen",
|
1190
|
+
buildContext
|
1599
1191
|
});
|
1600
|
-
|
1601
|
-
|
1602
|
-
const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
|
1603
|
-
getIsPrettierAvailable.cache = isPrettierAvailable;
|
1604
|
-
return isPrettierAvailable;
|
1605
|
-
}
|
1606
|
-
getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(undefined);
|
1607
|
-
async function getPrettier() {
|
1608
|
-
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
|
1609
|
-
if (getPrettier.cache !== undefined) {
|
1610
|
-
return getPrettier.cache;
|
1192
|
+
if (hasBeenHandled) {
|
1193
|
+
return;
|
1611
1194
|
}
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1195
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, "kc.gen.tsx");
|
1196
|
+
const hasLoginTheme = buildContext.implementedThemeTypes.login.isImplemented;
|
1197
|
+
const hasAccountTheme = buildContext.implementedThemeTypes.account.isImplemented;
|
1198
|
+
const hasAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
|
1199
|
+
let newContent = [
|
1200
|
+
``,
|
1201
|
+
`/* eslint-disable */`,
|
1202
|
+
``,
|
1203
|
+
`// @ts-nocheck`,
|
1204
|
+
``,
|
1205
|
+
`// noinspection JSUnusedGlobalSymbols`,
|
1206
|
+
``,
|
1207
|
+
`import { lazy, Suspense, type ReactNode } from "react";`,
|
1208
|
+
``,
|
1209
|
+
`export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(" | ")};`,
|
1210
|
+
``,
|
1211
|
+
`export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(", ")}];`,
|
1212
|
+
``,
|
1213
|
+
`export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? "never" : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(" | ")};`,
|
1214
|
+
``,
|
1215
|
+
`export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(", ")}];`,
|
1216
|
+
``,
|
1217
|
+
`export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
|
1218
|
+
``,
|
1219
|
+
`/**`,
|
1220
|
+
` * NOTE: Do not import this type except maybe in your entrypoint. `,
|
1221
|
+
` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
|
1222
|
+
` * Depending on the theme type you are working on.`,
|
1223
|
+
` */`,
|
1224
|
+
`export type KcContext =`,
|
1225
|
+
hasLoginTheme && ` | import("./login/KcContext").KcContext`,
|
1226
|
+
hasAccountTheme && ` | import("./account/KcContext").KcContext`,
|
1227
|
+
hasAdminTheme && ` | import("./admin/KcContext").KcContext`,
|
1228
|
+
` ;`,
|
1229
|
+
``,
|
1230
|
+
`declare global {`,
|
1231
|
+
` interface Window {`,
|
1232
|
+
` kcContext?: KcContext;`,
|
1233
|
+
` }`,
|
1234
|
+
`}`,
|
1235
|
+
``,
|
1236
|
+
hasLoginTheme &&
|
1237
|
+
`export const KcLoginPage = lazy(() => import("./login/KcPage"));`,
|
1238
|
+
hasAccountTheme &&
|
1239
|
+
`export const KcAccountPage = lazy(() => import("./account/KcPage"));`,
|
1240
|
+
hasAdminTheme &&
|
1241
|
+
`export const KcAdminPage = lazy(() => import("./admin/KcPage"));`,
|
1242
|
+
``,
|
1243
|
+
`export function KcPage(`,
|
1244
|
+
` props: {`,
|
1245
|
+
` kcContext: KcContext;`,
|
1246
|
+
` fallback?: ReactNode;`,
|
1247
|
+
` }`,
|
1248
|
+
`) {`,
|
1249
|
+
` const { kcContext, fallback } = props;`,
|
1250
|
+
` return (`,
|
1251
|
+
` <Suspense fallback={fallback}>`,
|
1252
|
+
` {(() => {`,
|
1253
|
+
` switch (kcContext.themeType) {`,
|
1254
|
+
hasLoginTheme &&
|
1255
|
+
` case "login": return <KcLoginPage kcContext={kcContext} />;`,
|
1256
|
+
hasAccountTheme &&
|
1257
|
+
` case "account": return <KcAccountPage kcContext={kcContext} />;`,
|
1258
|
+
hasAdminTheme &&
|
1259
|
+
` case "admin": return <KcAdminPage kcContext={kcContext} />;`,
|
1260
|
+
` }`,
|
1261
|
+
` })()}`,
|
1262
|
+
` </Suspense>`,
|
1263
|
+
` );`,
|
1264
|
+
`}`,
|
1265
|
+
``
|
1266
|
+
]
|
1267
|
+
.filter(item => typeof item === "string")
|
1268
|
+
.join("\n");
|
1269
|
+
const hash = crypto__WEBPACK_IMPORTED_MODULE_4__.createHash("sha256").update(newContent).digest("hex");
|
1270
|
+
skip_if_no_changes: {
|
1271
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(filePath))) {
|
1272
|
+
break skip_if_no_changes;
|
1273
|
+
}
|
1274
|
+
const currentContent = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
|
1275
|
+
if (!currentContent.includes(hash)) {
|
1276
|
+
break skip_if_no_changes;
|
1631
1277
|
}
|
1632
|
-
|
1278
|
+
return;
|
1633
1279
|
}
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1280
|
+
newContent = [
|
1281
|
+
`// This file is auto-generated by the \`update-kc-gen\` command. Do not edit it manually.`,
|
1282
|
+
`// Hash: ${hash}`,
|
1283
|
+
``,
|
1284
|
+
newContent
|
1285
|
+
].join("\n");
|
1286
|
+
format: {
|
1287
|
+
if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .getIsPrettierAvailable */ .MT)())) {
|
1288
|
+
break format;
|
1638
1289
|
}
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
const prettierAndConfig = {
|
1643
|
-
prettier,
|
1644
|
-
configHash
|
1645
|
-
};
|
1646
|
-
getPrettier.cache = prettierAndConfig;
|
1647
|
-
return prettierAndConfig;
|
1648
|
-
}
|
1649
|
-
async function runPrettier(params) {
|
1650
|
-
const { sourceCode, filePath } = params;
|
1651
|
-
let formattedSourceCode;
|
1652
|
-
try {
|
1653
|
-
const { prettier } = await getPrettier();
|
1654
|
-
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
1655
|
-
resolveConfig: true
|
1290
|
+
newContent = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_5__/* .runPrettier */ .eY)({
|
1291
|
+
filePath,
|
1292
|
+
sourceCode: newContent
|
1656
1293
|
});
|
1657
|
-
if (ignored || inferredParser === null) {
|
1658
|
-
return sourceCode;
|
1659
|
-
}
|
1660
|
-
const config = await prettier.resolveConfig(filePath);
|
1661
|
-
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
|
1662
1294
|
}
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1295
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, Buffer.from(newContent, "utf8"));
|
1296
|
+
delete_legacy_file: {
|
1297
|
+
const legacyFilePath = filePath.replace(/tsx$/, "ts");
|
1298
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_2__/* .existsAsync */ .o)(legacyFilePath))) {
|
1299
|
+
break delete_legacy_file;
|
1300
|
+
}
|
1301
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.unlink(legacyFilePath);
|
1666
1302
|
}
|
1667
|
-
return formattedSourceCode;
|
1668
1303
|
}
|
1669
|
-
//# sourceMappingURL=
|
1304
|
+
//# sourceMappingURL=update-kc-gen.js.map
|
1670
1305
|
|
1671
1306
|
/***/ })
|
1672
1307
|
|