fyn 1.1.37 → 1.1.38
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/dist/fyn.js +61 -12
- package/package.json +1 -1
package/dist/fyn.js
CHANGED
|
@@ -3366,12 +3366,15 @@ class Fyn {
|
|
|
3366
3366
|
|
|
3367
3367
|
if (!_.isEmpty(resData)) {
|
|
3368
3368
|
this._resolutions = resData;
|
|
3369
|
-
this._resolutionsMatchers = Object.keys(resData).map(
|
|
3370
|
-
const
|
|
3371
|
-
const
|
|
3369
|
+
this._resolutionsMatchers = Object.keys(resData).map(depPath => {
|
|
3370
|
+
const unslashedPath = fynTil.unSlashNpmScope(depPath);
|
|
3371
|
+
const pts = unslashedPath.split("/"); // spec can only contain ** between slashes
|
|
3372
|
+
|
|
3373
|
+
assert(!pts.find(x => !(!x.includes("*") || x === "**")), `resolution path '${depPath}' can only contain '**' for wildcard matching`);
|
|
3374
|
+
const finalPath = pts.length === 1 ? `**/${unslashedPath}` : unslashedPath;
|
|
3372
3375
|
return {
|
|
3373
|
-
mm: new mm.Minimatch(
|
|
3374
|
-
res: resData[
|
|
3376
|
+
mm: new mm.Minimatch(finalPath),
|
|
3377
|
+
res: resData[depPath]
|
|
3375
3378
|
};
|
|
3376
3379
|
});
|
|
3377
3380
|
}
|
|
@@ -5885,7 +5888,8 @@ const {
|
|
|
5885
5888
|
|
|
5886
5889
|
const {
|
|
5887
5890
|
checkPkgOsCpu,
|
|
5888
|
-
relativePath
|
|
5891
|
+
relativePath,
|
|
5892
|
+
unSlashNpmScope
|
|
5889
5893
|
} = __webpack_require__("./lib/util/fyntil.js");
|
|
5890
5894
|
|
|
5891
5895
|
const {
|
|
@@ -6968,7 +6972,8 @@ ${item.depPath.join(" > ")}`);
|
|
|
6968
6972
|
};
|
|
6969
6973
|
}
|
|
6970
6974
|
/**
|
|
6971
|
-
* Match a nested dep to user's resolutions data
|
|
6975
|
+
* Match a nested dep to user's resolutions data, or nested and direct dep for packages
|
|
6976
|
+
* inside a fynpo monorepo.
|
|
6972
6977
|
*
|
|
6973
6978
|
* spec: https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
|
|
6974
6979
|
*
|
|
@@ -6978,19 +6983,52 @@ ${item.depPath.join(" > ")}`);
|
|
|
6978
6983
|
|
|
6979
6984
|
|
|
6980
6985
|
_replaceWithResolutionsData(item) {
|
|
6981
|
-
if (
|
|
6986
|
+
if (!this._fyn._resolutions || item._semver.$$) {
|
|
6982
6987
|
return undefined;
|
|
6988
|
+
} //
|
|
6989
|
+
// this item represent a direct dependency
|
|
6990
|
+
//
|
|
6991
|
+
|
|
6992
|
+
|
|
6993
|
+
if (item.depth < 2) {
|
|
6994
|
+
//
|
|
6995
|
+
// if we have a package within a fynpo monorepo, then we replace its direct
|
|
6996
|
+
// dependencies with resolutions data, vs only its nested dependencies
|
|
6997
|
+
// according to yarn's resolutions spec, because if local package A pull in
|
|
6998
|
+
// another local package B, then B's dependencies would end up being
|
|
6999
|
+
// subjected to resolutions data, so for consistency, we check resolutions
|
|
7000
|
+
// for all fynpo's local packages' direct dependencies.
|
|
7001
|
+
//
|
|
7002
|
+
if (!this._fyn.isFynpo) {
|
|
7003
|
+
// not a fynpo, avoid checking resolutions for direct dependencies
|
|
7004
|
+
return undefined;
|
|
7005
|
+
}
|
|
6983
7006
|
}
|
|
6984
7007
|
|
|
6985
|
-
|
|
7008
|
+
let nameDepPath;
|
|
6986
7009
|
|
|
6987
|
-
|
|
7010
|
+
if (this._fyn.isFynpo) {
|
|
7011
|
+
nameDepPath = `${this._fyn._pkg.name}/${item.nameDepPath}`;
|
|
7012
|
+
} else {
|
|
7013
|
+
nameDepPath = item.nameDepPath;
|
|
7014
|
+
}
|
|
6988
7015
|
|
|
6989
|
-
|
|
7016
|
+
const unslashed = unSlashNpmScope(nameDepPath);
|
|
7017
|
+
|
|
7018
|
+
const found = this._fyn._resolutionsMatchers.find(r => r.mm.match(unslashed));
|
|
7019
|
+
|
|
7020
|
+
if (found && found.res && found.res !== "--no-change" && found.res !== item.semver) {
|
|
6990
7021
|
const {
|
|
6991
7022
|
res
|
|
6992
7023
|
} = found;
|
|
6993
|
-
|
|
7024
|
+
const msg = `${nameDepPath} changed to ${res} from ${item.semver} by resolutions data`;
|
|
7025
|
+
|
|
7026
|
+
if (item.depth < 2) {
|
|
7027
|
+
logger.info(`fynpo: ${msg}`);
|
|
7028
|
+
} else {
|
|
7029
|
+
logger.debug(msg);
|
|
7030
|
+
}
|
|
7031
|
+
|
|
6994
7032
|
semverUtil.replace(item._semver, res);
|
|
6995
7033
|
}
|
|
6996
7034
|
|
|
@@ -10238,6 +10276,17 @@ const fyntil = {
|
|
|
10238
10276
|
},
|
|
10239
10277
|
posixify,
|
|
10240
10278
|
|
|
10279
|
+
/**
|
|
10280
|
+
* Take a npm dependency path separated by / and replace the / that's meant for a npm scope with '+'
|
|
10281
|
+
*
|
|
10282
|
+
* @param {*} npmDepPath
|
|
10283
|
+
* @param {string} replacer string to replace the slash with
|
|
10284
|
+
* @returns dep path where npm scope's / replaced with '+'
|
|
10285
|
+
*/
|
|
10286
|
+
unSlashNpmScope(npmDepPath, replacer = "+") {
|
|
10287
|
+
return npmDepPath.replace(/(\@[^\/]+)\//g, (_a, b) => `${b}${replacer}`);
|
|
10288
|
+
},
|
|
10289
|
+
|
|
10241
10290
|
getGlobalNodeModules() {
|
|
10242
10291
|
const nodeDir = Path.dirname(process.execPath);
|
|
10243
10292
|
|