fyn 1.1.35 → 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.
Files changed (2) hide show
  1. package/dist/fyn.js +132 -22
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -2293,6 +2293,7 @@ class DepItem {
2293
2293
 
2294
2294
  this.promoted = undefined;
2295
2295
  this.depth = parent && parent.depth + 1 || options.depth || 0;
2296
+ this.nameDepPath = this.depth > 1 ? parent.nameDepPath + "/" + this.name : this.name;
2296
2297
  this.priority = options.priority;
2297
2298
  }
2298
2299
 
@@ -3097,6 +3098,8 @@ const {
3097
3098
  const {
3098
3099
  parseYarnLock
3099
3100
  } = __webpack_require__("./yarn/index.js");
3101
+
3102
+ const mm = __webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js");
3100
3103
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
3101
3104
 
3102
3105
 
@@ -3358,6 +3361,23 @@ class Fyn {
3358
3361
  }
3359
3362
 
3360
3363
  this._runNpm = _.uniq([].concat(this._options.runNpm, fynpoNpmRun).filter(x => x));
3364
+
3365
+ const resData = _objectSpread(_objectSpread({}, this._pkg.resolutions), _.get(this._fynpo, ["config", "resolutions"]));
3366
+
3367
+ if (!_.isEmpty(resData)) {
3368
+ this._resolutions = resData;
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;
3375
+ return {
3376
+ mm: new mm.Minimatch(finalPath),
3377
+ res: resData[depPath]
3378
+ };
3379
+ });
3380
+ }
3361
3381
  }
3362
3382
  }
3363
3383
 
@@ -5868,13 +5888,14 @@ const {
5868
5888
 
5869
5889
  const {
5870
5890
  checkPkgOsCpu,
5871
- relativePath
5891
+ relativePath,
5892
+ unSlashNpmScope
5872
5893
  } = __webpack_require__("./lib/util/fyntil.js");
5873
5894
 
5874
5895
  const {
5875
5896
  getDepSection,
5876
5897
  makeDepStep
5877
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/index.js");
5898
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
5878
5899
 
5879
5900
  const xaa = __webpack_require__("./lib/util/xaa.js");
5880
5901
 
@@ -5896,6 +5917,8 @@ const {
5896
5917
  PACKAGE_RAW_INFO,
5897
5918
  DEP_ITEM
5898
5919
  } = __webpack_require__("./lib/symbols.js");
5920
+
5921
+ const failMetaMsg = name => `Unable to retrieve meta for package ${name} - If you've updated its version recently, try to run fyn with '--refresh-meta' again`;
5899
5922
  /*
5900
5923
  * Package dependencies resolver
5901
5924
  *
@@ -6948,6 +6971,69 @@ ${item.depPath.join(" > ")}`);
6948
6971
  resolved
6949
6972
  };
6950
6973
  }
6974
+ /**
6975
+ * Match a nested dep to user's resolutions data, or nested and direct dep for packages
6976
+ * inside a fynpo monorepo.
6977
+ *
6978
+ * spec: https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
6979
+ *
6980
+ * @param {*} item
6981
+ * @returns
6982
+ */
6983
+
6984
+
6985
+ _replaceWithResolutionsData(item) {
6986
+ if (!this._fyn._resolutions || item._semver.$$) {
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
+ }
7006
+ }
7007
+
7008
+ let nameDepPath;
7009
+
7010
+ if (this._fyn.isFynpo) {
7011
+ nameDepPath = `${this._fyn._pkg.name}/${item.nameDepPath}`;
7012
+ } else {
7013
+ nameDepPath = item.nameDepPath;
7014
+ }
7015
+
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) {
7021
+ const {
7022
+ res
7023
+ } = found;
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
+
7032
+ semverUtil.replace(item._semver, res);
7033
+ }
7034
+
7035
+ return undefined;
7036
+ }
6951
7037
 
6952
7038
  _resolveWithLockData(item) {
6953
7039
  //
@@ -7062,19 +7148,21 @@ ${item.depPath.join(" > ")}`);
7062
7148
  });
7063
7149
  };
7064
7150
 
7065
- const promise = !item.semverPath || this._fyn.preferLock ? tryLock().then(r => r || item.semverPath && tryLocal()) : tryLocal().then(r => r || tryLock());
7066
-
7067
- const failMetaMsg = name => `Unable to retrieve meta for package ${name} - If you've updated its version recently, try to run fyn with '--refresh-meta' again`;
7151
+ this._replaceWithResolutionsData(item);
7068
7152
 
7153
+ const promise = !item.semverPath || this._fyn.preferLock ? tryLock().then(r => r || item.semverPath && tryLocal()) : tryLocal().then(r => r || tryLock());
7069
7154
  return promise.then(r => {
7070
7155
  if (r && !_.get(r, ["meta", "versions", r.resolved, "_missingJson"])) {
7071
7156
  return r;
7072
7157
  }
7073
7158
 
7074
- if (this._lockOnly || item.localType) return undefined; // neither local nor lock was able to resolve for item
7159
+ if (this._lockOnly || item.localType) {
7160
+ return undefined;
7161
+ } // neither local nor lock was able to resolve for item
7075
7162
  // so try to fetch from registry for real meta to resolve
7076
7163
  // always fetch the item and let pkg src manager deal with caching
7077
7164
 
7165
+
7078
7166
  return this._pkgSrcMgr.fetchMeta(item).then(meta => {
7079
7167
  if (!meta) {
7080
7168
  throw new Error(failMetaMsg(item.name));
@@ -7116,6 +7204,11 @@ ${item.depPath.join(" > ")}`);
7116
7204
  meta,
7117
7205
  resolved
7118
7206
  } = r;
7207
+
7208
+ if (item._semver.$$ && !Semver.satisfies(resolved, item._semver.$$)) {
7209
+ logger.warn(`${item.nameDepPath}@${resolved} resolved by resolutions data doesn't satisfy original semver ${item._semver.$$}`);
7210
+ }
7211
+
7119
7212
  await this.addPackageResolution(item, meta, resolved);
7120
7213
  }).then(() => {
7121
7214
  const depthData = this._depthResolving[item.depth];
@@ -8860,7 +8953,7 @@ const {
8860
8953
 
8861
8954
  const {
8862
8955
  PackageRef
8863
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/index.js");
8956
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
8864
8957
 
8865
8958
  const WATCH_TIME = 5000; // consider meta cache stale after this much time (30 minutes)
8866
8959
 
@@ -9878,7 +9971,7 @@ const {
9878
9971
  const {
9879
9972
  FynpoConfigManager,
9880
9973
  FynpoDepGraph
9881
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/index.js");
9974
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
9882
9975
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
9883
9976
 
9884
9977
 
@@ -10183,6 +10276,17 @@ const fyntil = {
10183
10276
  },
10184
10277
  posixify,
10185
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
+
10186
10290
  getGlobalNodeModules() {
10187
10291
  const nodeDir = Path.dirname(process.execPath);
10188
10292
 
@@ -11114,6 +11218,11 @@ function analyze(semver) {
11114
11218
 
11115
11219
  return sv;
11116
11220
  }
11221
+
11222
+ function replace(sv, replaced) {
11223
+ sv.$$ = sv.$;
11224
+ sv.$ = replaced;
11225
+ }
11117
11226
  /**
11118
11227
  * semver utilities lib
11119
11228
  */
@@ -11125,6 +11234,7 @@ const semverLib = {
11125
11234
  },
11126
11235
  split,
11127
11236
  analyze,
11237
+ replace,
11128
11238
  localify,
11129
11239
  localifyHard,
11130
11240
  unlocalify,
@@ -11382,7 +11492,7 @@ module.exports = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa
11382
11492
 
11383
11493
  /***/ }),
11384
11494
 
11385
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/caching.js":
11495
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/caching.js":
11386
11496
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11387
11497
 
11388
11498
  "use strict";
@@ -11403,7 +11513,7 @@ const fs_1 = (0, tslib_1.__importDefault)(__webpack_require__("fs"));
11403
11513
  const path_1 = (0, tslib_1.__importDefault)(__webpack_require__("path"));
11404
11514
  const crypto_1 = (0, tslib_1.__importDefault)(__webpack_require__("crypto"));
11405
11515
 
11406
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11516
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11407
11517
  /**
11408
11518
  * create a sha256 hash for some data
11409
11519
  *
@@ -11671,7 +11781,7 @@ exports.processOutput = processOutput;
11671
11781
 
11672
11782
  /***/ }),
11673
11783
 
11674
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11784
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11675
11785
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11676
11786
 
11677
11787
  "use strict";
@@ -11821,7 +11931,7 @@ exports.FynpoConfigManager = FynpoConfigManager;
11821
11931
 
11822
11932
  /***/ }),
11823
11933
 
11824
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11934
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11825
11935
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11826
11936
 
11827
11937
  "use strict";
@@ -11851,9 +11961,9 @@ const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_mod
11851
11961
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11852
11962
  const semver_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/semver/7.3.5/semver/index.js"));
11853
11963
 
11854
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11964
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11855
11965
 
11856
- const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/util.js");
11966
+ const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js");
11857
11967
 
11858
11968
  const is_path_inside_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/is-path-inside/3.0.3/is-path-inside/index.js"));
11859
11969
  const DepSectionMap = {
@@ -12582,7 +12692,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
12582
12692
 
12583
12693
  /***/ }),
12584
12694
 
12585
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/index.js":
12695
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js":
12586
12696
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12587
12697
 
12588
12698
  "use strict";
@@ -12604,12 +12714,12 @@ const filter_scan_dir_1 = __webpack_require__("./node_modules/.f/_/filter-scan-d
12604
12714
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
12605
12715
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
12606
12716
 
12607
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12717
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12608
12718
 
12609
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12610
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12611
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12612
- exports.caching = (0, tslib_1.__importStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/caching.js"));
12719
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12720
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12721
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12722
+ exports.caching = (0, tslib_1.__importStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/caching.js"));
12613
12723
  /**
12614
12724
  * Take an array of packages and figure out their dependencies on each other
12615
12725
  *
@@ -12865,7 +12975,7 @@ exports.makePkgDeps = makePkgDeps;
12865
12975
 
12866
12976
  /***/ }),
12867
12977
 
12868
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12978
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12869
12979
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12870
12980
 
12871
12981
  "use strict";
@@ -13004,7 +13114,7 @@ exports.unrollMmMatch = unrollMmMatch;
13004
13114
 
13005
13115
  /***/ }),
13006
13116
 
13007
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.14-fynlocal_h/@fynpo/base/dist/util.js":
13117
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js":
13008
13118
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13009
13119
 
13010
13120
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.35",
3
+ "version": "1.1.38",
4
4
  "description": "The package manager for fynpo, a zero setup monorepo manager",
5
5
  "main": "./bin/fyn.js",
6
6
  "homepage": "https://jchip.github.io/fynpo/",