keycloakify 11.8.46 → 11.8.47-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/254.index.js +283 -0
- package/bin/30.index.js +25 -0
- package/bin/{864.index.js → 309.index.js} +6944 -28439
- package/bin/311.index.js +198 -0
- package/bin/{313.index.js → 355.index.js} +101 -147
- package/bin/{84.index.js → 502.index.js} +147 -101
- package/bin/626.index.js +194 -0
- package/bin/{698.index.js → 656.index.js} +101 -147
- package/bin/675.index.js +177 -0
- package/bin/69.index.js +1 -1
- package/bin/762.index.js +1475 -0
- package/bin/780.index.js +4 -2
- package/bin/786.index.js +115 -0
- package/bin/895.index.js +21501 -0
- package/bin/{618.index.js → 932.index.js} +117 -163
- package/bin/949.index.js +1 -1
- package/bin/97.index.js +537 -4
- package/bin/init/index.d.ts +1 -0
- package/bin/init/init.d.ts +3 -0
- package/bin/init/setupEslint.d.ts +4 -0
- package/bin/init/setupVitePluginIfNeeded.d.ts +4 -0
- package/bin/initialize-login-theme.d.ts +4 -0
- package/bin/main.js +19 -30
- package/bin/shared/customHandler.d.ts +1 -1
- package/bin/shared/customHandler.js.map +1 -1
- package/package.json +23 -7
- package/src/bin/init/index.ts +1 -0
- package/src/bin/init/init.ts +354 -0
- package/src/bin/init/setupEslint.ts +80 -0
- package/src/bin/init/setupVitePluginIfNeeded.ts +143 -0
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +4 -0
- package/src/bin/initialize-login-theme.ts +323 -0
- package/src/bin/main.ts +14 -0
- package/src/bin/shared/buildContext.ts +2 -37
- package/src/bin/shared/customHandler.ts +3 -1
- package/src/bin/sync-extensions/extensionModuleMeta.ts +89 -73
- package/src/bin/sync-extensions/managedGitignoreFiles.ts +32 -2
- package/vite-plugin/index.js +1 -24
- package/bin/433.index.js +0 -140
package/bin/97.index.js
CHANGED
@@ -206,7 +206,9 @@ async function getExtensionModuleMetas(params) {
|
|
206
206
|
});
|
207
207
|
return extensionModuleMetas_cacheUpToDate;
|
208
208
|
})();
|
209
|
-
const extensionModuleMetas = await Promise.all(installedExtensionModules
|
209
|
+
const extensionModuleMetas = await Promise.all([...installedExtensionModules]
|
210
|
+
.sort((a, b) => a.moduleName.localeCompare(b.moduleName))
|
211
|
+
.map(async ({ moduleName, version, peerDependencies, dirPath }) => {
|
210
212
|
use_cache: {
|
211
213
|
const extensionModuleMeta_cache = extensionModuleMetas_cacheUpToDate.find(extensionModuleMeta => extensionModuleMeta.moduleName === moduleName);
|
212
214
|
if (extensionModuleMeta_cache === undefined) {
|
@@ -249,11 +251,17 @@ async function getExtensionModuleMetas(params) {
|
|
249
251
|
});
|
250
252
|
}
|
251
253
|
});
|
254
|
+
{
|
255
|
+
const getId = (file) => `${file.isPublic ? "public" : "src"} - ${file.fileRelativePath}`;
|
256
|
+
files.sort((a, b) => getId(a).localeCompare(getId(b)));
|
257
|
+
}
|
252
258
|
return (0,id.id)({
|
253
259
|
moduleName,
|
254
260
|
version,
|
255
261
|
files,
|
256
|
-
peerDependencies: Object.fromEntries(Object.entries(peerDependencies)
|
262
|
+
peerDependencies: Object.fromEntries(Object.entries(peerDependencies)
|
263
|
+
.filter(([moduleName]) => !isAmong(["react", "@types/react"], moduleName))
|
264
|
+
.sort(([moduleName_a], [moduleName_b]) => moduleName_a.localeCompare(moduleName_b)))
|
257
265
|
});
|
258
266
|
}));
|
259
267
|
update_cache: {
|
@@ -485,10 +493,15 @@ async function writeManagedGitignoreFiles(params) {
|
|
485
493
|
...ownedFilesRelativePaths_ctx
|
486
494
|
.map(({ fileRelativePath }) => fileRelativePath)
|
487
495
|
.map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
|
496
|
+
.sort(posixPathCompareFn)
|
488
497
|
.map(line => `# ${line}`),
|
489
498
|
DELIMITER_END,
|
490
499
|
``,
|
491
|
-
...extensionModuleMetas_ctx
|
500
|
+
...[...extensionModuleMetas_ctx]
|
501
|
+
.sort((a, b) => {
|
502
|
+
const n = a.moduleName.length - b.moduleName.length;
|
503
|
+
return n !== 0 ? n : a.moduleName.localeCompare(b.moduleName);
|
504
|
+
})
|
492
505
|
.map(extensionModuleMeta => [
|
493
506
|
`# === ${extensionModuleMeta.moduleName} v${extensionModuleMeta.version} ===`,
|
494
507
|
...extensionModuleMeta.files
|
@@ -496,7 +509,8 @@ async function writeManagedGitignoreFiles(params) {
|
|
496
509
|
.filter(fileRelativePath => !ownedFilesRelativePaths_ctx
|
497
510
|
.map(({ fileRelativePath }) => fileRelativePath)
|
498
511
|
.includes(fileRelativePath))
|
499
|
-
.map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`)
|
512
|
+
.map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`)
|
513
|
+
.sort(posixPathCompareFn),
|
500
514
|
``
|
501
515
|
])
|
502
516
|
.flat()
|
@@ -561,6 +575,24 @@ async function readManagedGitignoresFile(params) {
|
|
561
575
|
}
|
562
576
|
return { ownedFilesRelativePaths };
|
563
577
|
}
|
578
|
+
function posixPathCompareFn(a, b) {
|
579
|
+
const aParts = a.split("/");
|
580
|
+
const bParts = b.split("/");
|
581
|
+
const diff = aParts.length - bParts.length;
|
582
|
+
if (diff !== 0) {
|
583
|
+
return diff;
|
584
|
+
}
|
585
|
+
const len = Math.min(aParts.length, bParts.length);
|
586
|
+
for (let i = 0; i < len; i++) {
|
587
|
+
const cmp = aParts[i].localeCompare(bParts[i], undefined, {
|
588
|
+
numeric: true,
|
589
|
+
sensitivity: "base"
|
590
|
+
});
|
591
|
+
if (cmp !== 0)
|
592
|
+
return cmp;
|
593
|
+
}
|
594
|
+
return 0;
|
595
|
+
}
|
564
596
|
//# sourceMappingURL=managedGitignoreFiles.js.map
|
565
597
|
|
566
598
|
/***/ }),
|
@@ -827,6 +859,507 @@ async function command(params) {
|
|
827
859
|
}
|
828
860
|
//# sourceMappingURL=sync-extension.js.map
|
829
861
|
|
862
|
+
/***/ }),
|
863
|
+
|
864
|
+
/***/ 12171:
|
865
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
866
|
+
|
867
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
868
|
+
/* harmony export */ "h": () => (/* binding */ SemVer)
|
869
|
+
/* harmony export */ });
|
870
|
+
var SemVer;
|
871
|
+
(function (SemVer) {
|
872
|
+
const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
|
873
|
+
function parse(versionStr) {
|
874
|
+
const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
|
875
|
+
if (!match) {
|
876
|
+
throw new Error(`${versionStr} is not a valid semantic version`);
|
877
|
+
}
|
878
|
+
const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
|
879
|
+
const str = match[3];
|
880
|
+
return str === undefined ? 0 : parseInt(str);
|
881
|
+
})() }, (() => {
|
882
|
+
const str = match[4];
|
883
|
+
return str === undefined ? {} : { rc: parseInt(str) };
|
884
|
+
})());
|
885
|
+
const initialStr = stringify(semVer);
|
886
|
+
Object.defineProperty(semVer, "parsedFrom", {
|
887
|
+
enumerable: true,
|
888
|
+
get: function () {
|
889
|
+
const currentStr = stringify(this);
|
890
|
+
if (currentStr !== initialStr) {
|
891
|
+
throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
|
892
|
+
}
|
893
|
+
return versionStr;
|
894
|
+
}
|
895
|
+
});
|
896
|
+
return semVer;
|
897
|
+
}
|
898
|
+
SemVer.parse = parse;
|
899
|
+
function stringify(v) {
|
900
|
+
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
|
901
|
+
}
|
902
|
+
SemVer.stringify = stringify;
|
903
|
+
/**
|
904
|
+
*
|
905
|
+
* v1 < v2 => -1
|
906
|
+
* v1 === v2 => 0
|
907
|
+
* v1 > v2 => 1
|
908
|
+
*
|
909
|
+
*/
|
910
|
+
function compare(v1, v2) {
|
911
|
+
const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
|
912
|
+
const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
|
913
|
+
for (const level of ["major", "minor", "patch", "rc"]) {
|
914
|
+
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
|
915
|
+
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
|
916
|
+
}
|
917
|
+
}
|
918
|
+
return 0;
|
919
|
+
}
|
920
|
+
SemVer.compare = compare;
|
921
|
+
/*
|
922
|
+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
|
923
|
+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
|
924
|
+
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
|
925
|
+
*/
|
926
|
+
function bumpType(params) {
|
927
|
+
const versionAhead = typeof params.versionAhead === "string"
|
928
|
+
? parse(params.versionAhead)
|
929
|
+
: params.versionAhead;
|
930
|
+
const versionBehind = typeof params.versionBehind === "string"
|
931
|
+
? parse(params.versionBehind)
|
932
|
+
: params.versionBehind;
|
933
|
+
if (compare(versionBehind, versionAhead) === 1) {
|
934
|
+
throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
|
935
|
+
}
|
936
|
+
for (const level of ["major", "minor", "patch", "rc"]) {
|
937
|
+
if (versionBehind[level] !== versionAhead[level]) {
|
938
|
+
return level;
|
939
|
+
}
|
940
|
+
}
|
941
|
+
return "no bump";
|
942
|
+
}
|
943
|
+
SemVer.bumpType = bumpType;
|
944
|
+
})(SemVer || (SemVer = {}));
|
945
|
+
//# sourceMappingURL=SemVer.js.map
|
946
|
+
|
947
|
+
/***/ }),
|
948
|
+
|
949
|
+
/***/ 89693:
|
950
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
951
|
+
|
952
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
953
|
+
/* harmony export */ "a": () => (/* binding */ rmSync)
|
954
|
+
/* harmony export */ });
|
955
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
|
956
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
957
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
|
958
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
959
|
+
/* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
|
960
|
+
|
961
|
+
|
962
|
+
|
963
|
+
/**
|
964
|
+
* Polyfill of fs.rmSync(dirPath, { "recursive": true })
|
965
|
+
* For older version of Node
|
966
|
+
*/
|
967
|
+
function rmSync(dirPath, options) {
|
968
|
+
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) {
|
969
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
|
970
|
+
return;
|
971
|
+
}
|
972
|
+
const { force = true } = options;
|
973
|
+
if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
|
974
|
+
return;
|
975
|
+
}
|
976
|
+
const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
|
977
|
+
const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
|
978
|
+
if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
|
979
|
+
removeDir_rec(fileOrDirPath);
|
980
|
+
return;
|
981
|
+
}
|
982
|
+
else {
|
983
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
|
984
|
+
}
|
985
|
+
});
|
986
|
+
removeDir_rec(dirPath);
|
987
|
+
}
|
988
|
+
//# sourceMappingURL=fs.rmSync.js.map
|
989
|
+
|
990
|
+
/***/ }),
|
991
|
+
|
992
|
+
/***/ 63046:
|
993
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
994
|
+
|
995
|
+
|
996
|
+
// EXPORTS
|
997
|
+
__webpack_require__.d(__webpack_exports__, {
|
998
|
+
"c": () => (/* binding */ npmInstall)
|
999
|
+
});
|
1000
|
+
|
1001
|
+
// EXTERNAL MODULE: external "fs"
|
1002
|
+
var external_fs_ = __webpack_require__(57147);
|
1003
|
+
// EXTERNAL MODULE: external "path"
|
1004
|
+
var external_path_ = __webpack_require__(71017);
|
1005
|
+
// EXTERNAL MODULE: external "child_process"
|
1006
|
+
var external_child_process_ = __webpack_require__(32081);
|
1007
|
+
// EXTERNAL MODULE: ./node_modules/chalk/source/index.js
|
1008
|
+
var source = __webpack_require__(78818);
|
1009
|
+
var source_default = /*#__PURE__*/__webpack_require__.n(source);
|
1010
|
+
// EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
|
1011
|
+
var lib = __webpack_require__(52300);
|
1012
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
1013
|
+
var assert = __webpack_require__(29041);
|
1014
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
1015
|
+
var id = __webpack_require__(38469);
|
1016
|
+
;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
|
1017
|
+
/** https://docs.tsafe.dev/objectKeys */
|
1018
|
+
function objectKeys(o) {
|
1019
|
+
return Object.keys(o);
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
|
1023
|
+
//# sourceMappingURL=objectKeys.mjs.map
|
1024
|
+
|
1025
|
+
// EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
|
1026
|
+
var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
|
1027
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
|
1028
|
+
var exclude = __webpack_require__(83101);
|
1029
|
+
// EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
|
1030
|
+
var fs_rmSync = __webpack_require__(89693);
|
1031
|
+
// EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
|
1032
|
+
var Deferred = __webpack_require__(50689);
|
1033
|
+
;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
|
1034
|
+
|
1035
|
+
|
1036
|
+
|
1037
|
+
|
1038
|
+
|
1039
|
+
|
1040
|
+
|
1041
|
+
|
1042
|
+
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
async function npmInstall(params) {
|
1047
|
+
const { packageJsonDirPath } = params;
|
1048
|
+
const packageManagerBinName = (() => {
|
1049
|
+
const packageMangers = [
|
1050
|
+
{
|
1051
|
+
binName: "yarn",
|
1052
|
+
lockFileBasename: "yarn.lock"
|
1053
|
+
},
|
1054
|
+
{
|
1055
|
+
binName: "npm",
|
1056
|
+
lockFileBasename: "package-lock.json"
|
1057
|
+
},
|
1058
|
+
{
|
1059
|
+
binName: "pnpm",
|
1060
|
+
lockFileBasename: "pnpm-lock.yaml"
|
1061
|
+
},
|
1062
|
+
{
|
1063
|
+
binName: "bun",
|
1064
|
+
lockFileBasename: "bun.lockdb"
|
1065
|
+
},
|
1066
|
+
{
|
1067
|
+
binName: "deno",
|
1068
|
+
lockFileBasename: "deno.lock"
|
1069
|
+
}
|
1070
|
+
];
|
1071
|
+
for (const packageManager of packageMangers) {
|
1072
|
+
if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
|
1073
|
+
external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
|
1074
|
+
return packageManager.binName;
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
|
1078
|
+
})();
|
1079
|
+
console.log(`Installing the new dependencies...`);
|
1080
|
+
install_without_breaking_links: {
|
1081
|
+
if (packageManagerBinName !== "yarn") {
|
1082
|
+
break install_without_breaking_links;
|
1083
|
+
}
|
1084
|
+
const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
|
1085
|
+
if (garronejLinkInfos === undefined) {
|
1086
|
+
break install_without_breaking_links;
|
1087
|
+
}
|
1088
|
+
console.log(source_default().green("Installing in a way that won't break the links..."));
|
1089
|
+
await installWithoutBreakingLinks({
|
1090
|
+
packageJsonDirPath,
|
1091
|
+
garronejLinkInfos
|
1092
|
+
});
|
1093
|
+
return;
|
1094
|
+
}
|
1095
|
+
try {
|
1096
|
+
await runPackageManagerInstall({
|
1097
|
+
packageManagerBinName,
|
1098
|
+
cwd: packageJsonDirPath
|
1099
|
+
});
|
1100
|
+
}
|
1101
|
+
catch (_a) {
|
1102
|
+
console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
|
1103
|
+
}
|
1104
|
+
}
|
1105
|
+
async function runPackageManagerInstall(params) {
|
1106
|
+
const { packageManagerBinName, cwd } = params;
|
1107
|
+
const dCompleted = new Deferred.Deferred();
|
1108
|
+
const child = external_child_process_.spawn(packageManagerBinName, ["install"], {
|
1109
|
+
cwd,
|
1110
|
+
env: process.env,
|
1111
|
+
shell: true
|
1112
|
+
});
|
1113
|
+
child.stdout.on("data", data => process.stdout.write(data));
|
1114
|
+
child.stderr.on("data", data => {
|
1115
|
+
if (data.toString("utf8").includes("peer dependency")) {
|
1116
|
+
return;
|
1117
|
+
}
|
1118
|
+
process.stderr.write(data);
|
1119
|
+
});
|
1120
|
+
child.on("exit", code => {
|
1121
|
+
if (code !== 0) {
|
1122
|
+
dCompleted.reject(new Error(`Failed with code ${code}`));
|
1123
|
+
return;
|
1124
|
+
}
|
1125
|
+
dCompleted.resolve();
|
1126
|
+
});
|
1127
|
+
await dCompleted.pr;
|
1128
|
+
}
|
1129
|
+
function getGarronejLinkInfos(params) {
|
1130
|
+
const { packageJsonDirPath } = params;
|
1131
|
+
const nodeModuleDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
1132
|
+
if (!external_fs_.existsSync(nodeModuleDirPath)) {
|
1133
|
+
return undefined;
|
1134
|
+
}
|
1135
|
+
const linkedModuleNames = [];
|
1136
|
+
let yarnHomeDirPath = undefined;
|
1137
|
+
const getIsLinkedByGarronejScript = (path) => {
|
1138
|
+
let realPath;
|
1139
|
+
try {
|
1140
|
+
realPath = external_fs_.readlinkSync(path);
|
1141
|
+
}
|
1142
|
+
catch (_a) {
|
1143
|
+
return false;
|
1144
|
+
}
|
1145
|
+
const doesIncludeYarnHome = realPath.includes(".yarn_home");
|
1146
|
+
if (!doesIncludeYarnHome) {
|
1147
|
+
return false;
|
1148
|
+
}
|
1149
|
+
set_yarnHomeDirPath: {
|
1150
|
+
if (yarnHomeDirPath !== undefined) {
|
1151
|
+
break set_yarnHomeDirPath;
|
1152
|
+
}
|
1153
|
+
const [firstElement] = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
1154
|
+
pathIsh: realPath,
|
1155
|
+
cwd: (0,external_path_.dirname)(path)
|
1156
|
+
}).split(".yarn_home");
|
1157
|
+
yarnHomeDirPath = (0,external_path_.join)(firstElement, ".yarn_home");
|
1158
|
+
}
|
1159
|
+
return true;
|
1160
|
+
};
|
1161
|
+
for (const basename of external_fs_.readdirSync(nodeModuleDirPath)) {
|
1162
|
+
const path = (0,external_path_.join)(nodeModuleDirPath, basename);
|
1163
|
+
if (external_fs_.lstatSync(path).isSymbolicLink()) {
|
1164
|
+
if (basename.startsWith("@")) {
|
1165
|
+
return undefined;
|
1166
|
+
}
|
1167
|
+
if (!getIsLinkedByGarronejScript(path)) {
|
1168
|
+
return undefined;
|
1169
|
+
}
|
1170
|
+
linkedModuleNames.push(basename);
|
1171
|
+
continue;
|
1172
|
+
}
|
1173
|
+
if (!external_fs_.lstatSync(path).isDirectory()) {
|
1174
|
+
continue;
|
1175
|
+
}
|
1176
|
+
if (basename.startsWith("@")) {
|
1177
|
+
for (const subBasename of external_fs_.readdirSync(path)) {
|
1178
|
+
const subPath = (0,external_path_.join)(path, subBasename);
|
1179
|
+
if (!external_fs_.lstatSync(subPath).isSymbolicLink()) {
|
1180
|
+
continue;
|
1181
|
+
}
|
1182
|
+
if (!getIsLinkedByGarronejScript(subPath)) {
|
1183
|
+
return undefined;
|
1184
|
+
}
|
1185
|
+
linkedModuleNames.push(`${basename}/${subBasename}`);
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
}
|
1189
|
+
if (yarnHomeDirPath === undefined) {
|
1190
|
+
return undefined;
|
1191
|
+
}
|
1192
|
+
return { linkedModuleNames, yarnHomeDirPath };
|
1193
|
+
}
|
1194
|
+
async function installWithoutBreakingLinks(params) {
|
1195
|
+
const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
|
1196
|
+
const parsedPackageJson = (() => {
|
1197
|
+
const packageJsonFilePath = (0,external_path_.join)(packageJsonDirPath, "package.json");
|
1198
|
+
const zParsedPackageJson = (() => {
|
1199
|
+
const zTargetType = lib.z.object({
|
1200
|
+
scripts: lib.z.record(lib.z.string()).optional()
|
1201
|
+
});
|
1202
|
+
assert/* assert */.h;
|
1203
|
+
return (0,id.id)(zTargetType);
|
1204
|
+
})();
|
1205
|
+
const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
1206
|
+
zParsedPackageJson.parse(parsedPackageJson);
|
1207
|
+
(0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
|
1208
|
+
return parsedPackageJson;
|
1209
|
+
})();
|
1210
|
+
const isImplementedScriptByName = {
|
1211
|
+
postinstall: false,
|
1212
|
+
prepare: false
|
1213
|
+
};
|
1214
|
+
delete_postinstall_script: {
|
1215
|
+
if (parsedPackageJson.scripts === undefined) {
|
1216
|
+
break delete_postinstall_script;
|
1217
|
+
}
|
1218
|
+
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
1219
|
+
if (parsedPackageJson.scripts[scriptName] === undefined) {
|
1220
|
+
continue;
|
1221
|
+
}
|
1222
|
+
isImplementedScriptByName[scriptName] = true;
|
1223
|
+
delete parsedPackageJson.scripts[scriptName];
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
const tmpProjectDirPath = (0,external_path_.join)(yarnHomeDirPath, "tmpProject");
|
1227
|
+
if (external_fs_.existsSync(tmpProjectDirPath)) {
|
1228
|
+
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
1229
|
+
}
|
1230
|
+
external_fs_.mkdirSync(tmpProjectDirPath, { recursive: true });
|
1231
|
+
external_fs_.writeFileSync((0,external_path_.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
|
1232
|
+
const YARN_LOCK = "yarn.lock";
|
1233
|
+
external_fs_.copyFileSync((0,external_path_.join)(packageJsonDirPath, YARN_LOCK), (0,external_path_.join)(tmpProjectDirPath, YARN_LOCK));
|
1234
|
+
await runPackageManagerInstall({
|
1235
|
+
packageManagerBinName: "yarn",
|
1236
|
+
cwd: tmpProjectDirPath
|
1237
|
+
});
|
1238
|
+
// NOTE: Moving the modules from the tmp project to the actual project
|
1239
|
+
// without messing up the links.
|
1240
|
+
{
|
1241
|
+
const { getAreSameVersions } = (() => {
|
1242
|
+
const zParsedPackageJson = (() => {
|
1243
|
+
const zTargetType = lib.z.object({
|
1244
|
+
version: lib.z.string()
|
1245
|
+
});
|
1246
|
+
assert/* assert */.h;
|
1247
|
+
return (0,id.id)(zTargetType);
|
1248
|
+
})();
|
1249
|
+
function readVersion(params) {
|
1250
|
+
const { moduleDirPath } = params;
|
1251
|
+
const packageJsonFilePath = (0,external_path_.join)(moduleDirPath, "package.json");
|
1252
|
+
const packageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
1253
|
+
zParsedPackageJson.parse(packageJson);
|
1254
|
+
(0,assert/* assert */.h)((0,assert.is)(packageJson));
|
1255
|
+
return packageJson.version;
|
1256
|
+
}
|
1257
|
+
function getAreSameVersions(params) {
|
1258
|
+
const { moduleDirPath_a, moduleDirPath_b } = params;
|
1259
|
+
return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
|
1260
|
+
readVersion({ moduleDirPath: moduleDirPath_b }));
|
1261
|
+
}
|
1262
|
+
return { getAreSameVersions };
|
1263
|
+
})();
|
1264
|
+
const nodeModulesDirPath_tmpProject = (0,external_path_.join)(tmpProjectDirPath, "node_modules");
|
1265
|
+
const nodeModulesDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
1266
|
+
const modulePaths = external_fs_.readdirSync(nodeModulesDirPath_tmpProject)
|
1267
|
+
.map(basename => {
|
1268
|
+
if (basename.startsWith(".")) {
|
1269
|
+
return undefined;
|
1270
|
+
}
|
1271
|
+
const path = (0,external_path_.join)(nodeModulesDirPath_tmpProject, basename);
|
1272
|
+
if (basename.startsWith("@")) {
|
1273
|
+
return external_fs_.readdirSync(path)
|
1274
|
+
.map(subBasename => {
|
1275
|
+
if (subBasename.startsWith(".")) {
|
1276
|
+
return undefined;
|
1277
|
+
}
|
1278
|
+
const subPath = (0,external_path_.join)(path, subBasename);
|
1279
|
+
if (!external_fs_.lstatSync(subPath).isDirectory()) {
|
1280
|
+
return undefined;
|
1281
|
+
}
|
1282
|
+
return {
|
1283
|
+
moduleName: `${basename}/${subBasename}`,
|
1284
|
+
moduleDirPath_tmpProject: subPath,
|
1285
|
+
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename, subBasename)
|
1286
|
+
};
|
1287
|
+
})
|
1288
|
+
.filter((0,exclude/* exclude */.D)(undefined));
|
1289
|
+
}
|
1290
|
+
if (!external_fs_.lstatSync(path).isDirectory()) {
|
1291
|
+
return undefined;
|
1292
|
+
}
|
1293
|
+
return [
|
1294
|
+
{
|
1295
|
+
moduleName: basename,
|
1296
|
+
moduleDirPath_tmpProject: path,
|
1297
|
+
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename)
|
1298
|
+
}
|
1299
|
+
];
|
1300
|
+
})
|
1301
|
+
.filter((0,exclude/* exclude */.D)(undefined))
|
1302
|
+
.flat();
|
1303
|
+
for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
|
1304
|
+
if (linkedModuleNames.includes(moduleName)) {
|
1305
|
+
continue;
|
1306
|
+
}
|
1307
|
+
let doesTargetModuleExist = false;
|
1308
|
+
skip_condition: {
|
1309
|
+
if (!external_fs_.existsSync(moduleDirPath)) {
|
1310
|
+
break skip_condition;
|
1311
|
+
}
|
1312
|
+
doesTargetModuleExist = true;
|
1313
|
+
const areSameVersions = getAreSameVersions({
|
1314
|
+
moduleDirPath_a: moduleDirPath,
|
1315
|
+
moduleDirPath_b: moduleDirPath_tmpProject
|
1316
|
+
});
|
1317
|
+
if (!areSameVersions) {
|
1318
|
+
break skip_condition;
|
1319
|
+
}
|
1320
|
+
continue;
|
1321
|
+
}
|
1322
|
+
if (doesTargetModuleExist) {
|
1323
|
+
(0,fs_rmSync/* rmSync */.a)(moduleDirPath, { recursive: true });
|
1324
|
+
}
|
1325
|
+
{
|
1326
|
+
const dirPath = (0,external_path_.dirname)(moduleDirPath);
|
1327
|
+
if (!external_fs_.existsSync(dirPath)) {
|
1328
|
+
external_fs_.mkdirSync(dirPath, { recursive: true });
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
external_fs_.renameSync(moduleDirPath_tmpProject, moduleDirPath);
|
1332
|
+
}
|
1333
|
+
move_bin: {
|
1334
|
+
const binDirPath_tmpProject = (0,external_path_.join)(nodeModulesDirPath_tmpProject, ".bin");
|
1335
|
+
const binDirPath = (0,external_path_.join)(nodeModulesDirPath, ".bin");
|
1336
|
+
if (!external_fs_.existsSync(binDirPath_tmpProject)) {
|
1337
|
+
break move_bin;
|
1338
|
+
}
|
1339
|
+
for (const basename of external_fs_.readdirSync(binDirPath_tmpProject)) {
|
1340
|
+
const path_tmpProject = (0,external_path_.join)(binDirPath_tmpProject, basename);
|
1341
|
+
const path = (0,external_path_.join)(binDirPath, basename);
|
1342
|
+
if (external_fs_.existsSync(path)) {
|
1343
|
+
continue;
|
1344
|
+
}
|
1345
|
+
external_fs_.renameSync(path_tmpProject, path);
|
1346
|
+
}
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
external_fs_.cpSync((0,external_path_.join)(tmpProjectDirPath, YARN_LOCK), (0,external_path_.join)(packageJsonDirPath, YARN_LOCK));
|
1350
|
+
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
1351
|
+
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
1352
|
+
if (!isImplementedScriptByName[scriptName]) {
|
1353
|
+
continue;
|
1354
|
+
}
|
1355
|
+
external_child_process_.execSync(`yarn run ${scriptName}`, {
|
1356
|
+
cwd: packageJsonDirPath,
|
1357
|
+
stdio: "inherit"
|
1358
|
+
});
|
1359
|
+
}
|
1360
|
+
}
|
1361
|
+
//# sourceMappingURL=npmInstall.js.map
|
1362
|
+
|
830
1363
|
/***/ })
|
831
1364
|
|
832
1365
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./init";
|