fyn 1.1.36 → 1.1.37

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 +65 -4
  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,20 @@ 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(x => {
3370
+ const pts = x.split("/");
3371
+ const x2 = pts.length === 1 || pts[0][0] === "@" && pts.length === 2 ? `**/${x}` : x;
3372
+ return {
3373
+ mm: new mm.Minimatch(x2),
3374
+ res: resData[x]
3375
+ };
3376
+ });
3377
+ }
3361
3378
  }
3362
3379
  }
3363
3380
 
@@ -5896,6 +5913,8 @@ const {
5896
5913
  PACKAGE_RAW_INFO,
5897
5914
  DEP_ITEM
5898
5915
  } = __webpack_require__("./lib/symbols.js");
5916
+
5917
+ 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
5918
  /*
5900
5919
  * Package dependencies resolver
5901
5920
  *
@@ -6948,6 +6967,35 @@ ${item.depPath.join(" > ")}`);
6948
6967
  resolved
6949
6968
  };
6950
6969
  }
6970
+ /**
6971
+ * Match a nested dep to user's resolutions data
6972
+ *
6973
+ * spec: https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
6974
+ *
6975
+ * @param {*} item
6976
+ * @returns
6977
+ */
6978
+
6979
+
6980
+ _replaceWithResolutionsData(item) {
6981
+ if (item.depth < 2 || !this._fyn._resolutions || item._semver.$$) {
6982
+ return undefined;
6983
+ }
6984
+
6985
+ const depPath = item.nameDepPath;
6986
+
6987
+ const found = this._fyn._resolutionsMatchers.find(r => r.mm.match(depPath));
6988
+
6989
+ if (found) {
6990
+ const {
6991
+ res
6992
+ } = found;
6993
+ logger.debug(`${depPath} changed to ${res} from ${item.semver} by resolutions data`);
6994
+ semverUtil.replace(item._semver, res);
6995
+ }
6996
+
6997
+ return undefined;
6998
+ }
6951
6999
 
6952
7000
  _resolveWithLockData(item) {
6953
7001
  //
@@ -7062,19 +7110,21 @@ ${item.depPath.join(" > ")}`);
7062
7110
  });
7063
7111
  };
7064
7112
 
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`;
7113
+ this._replaceWithResolutionsData(item);
7068
7114
 
7115
+ const promise = !item.semverPath || this._fyn.preferLock ? tryLock().then(r => r || item.semverPath && tryLocal()) : tryLocal().then(r => r || tryLock());
7069
7116
  return promise.then(r => {
7070
7117
  if (r && !_.get(r, ["meta", "versions", r.resolved, "_missingJson"])) {
7071
7118
  return r;
7072
7119
  }
7073
7120
 
7074
- if (this._lockOnly || item.localType) return undefined; // neither local nor lock was able to resolve for item
7121
+ if (this._lockOnly || item.localType) {
7122
+ return undefined;
7123
+ } // neither local nor lock was able to resolve for item
7075
7124
  // so try to fetch from registry for real meta to resolve
7076
7125
  // always fetch the item and let pkg src manager deal with caching
7077
7126
 
7127
+
7078
7128
  return this._pkgSrcMgr.fetchMeta(item).then(meta => {
7079
7129
  if (!meta) {
7080
7130
  throw new Error(failMetaMsg(item.name));
@@ -7116,6 +7166,11 @@ ${item.depPath.join(" > ")}`);
7116
7166
  meta,
7117
7167
  resolved
7118
7168
  } = r;
7169
+
7170
+ if (item._semver.$$ && !Semver.satisfies(resolved, item._semver.$$)) {
7171
+ logger.warn(`${item.nameDepPath}@${resolved} resolved by resolutions data doesn't satisfy original semver ${item._semver.$$}`);
7172
+ }
7173
+
7119
7174
  await this.addPackageResolution(item, meta, resolved);
7120
7175
  }).then(() => {
7121
7176
  const depthData = this._depthResolving[item.depth];
@@ -11114,6 +11169,11 @@ function analyze(semver) {
11114
11169
 
11115
11170
  return sv;
11116
11171
  }
11172
+
11173
+ function replace(sv, replaced) {
11174
+ sv.$$ = sv.$;
11175
+ sv.$ = replaced;
11176
+ }
11117
11177
  /**
11118
11178
  * semver utilities lib
11119
11179
  */
@@ -11125,6 +11185,7 @@ const semverLib = {
11125
11185
  },
11126
11186
  split,
11127
11187
  analyze,
11188
+ replace,
11128
11189
  localify,
11129
11190
  localifyHard,
11130
11191
  unlocalify,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
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/",