fyn 1.1.37 → 1.1.40

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 +288 -90
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -2690,8 +2690,8 @@ class FynCentral {
2690
2690
  return info.mutates ? false : true;
2691
2691
  }
2692
2692
 
2693
- async get(integrity) {
2694
- return await this.getInfo(integrity).contentPath;
2693
+ async getContentPath(integrity) {
2694
+ return (await this.getInfo(integrity)).contentPath;
2695
2695
  }
2696
2696
 
2697
2697
  async getInfo(integrity) {
@@ -2707,21 +2707,10 @@ class FynCentral {
2707
2707
 
2708
2708
  return info;
2709
2709
  }
2710
- /**
2711
- * Get the hash of a npm package's extracted content.
2712
- * - only consider the file names and their mtime and size because npm tar files
2713
- * with a fixed timestamp to publish, so the mtime give us some assurance
2714
- * to know if file changed.
2715
- *
2716
- * @param {*} integrity - shasum integrity for the package
2717
- * @returns void
2718
- */
2719
-
2720
2710
 
2721
- async getContentShasum(integrity) {
2711
+ async _calcContentShasum(info, pkgDir = undefined) {
2722
2712
  try {
2723
- const info = await this.getInfo(integrity);
2724
- const packageDir = Path.join(info.contentPath, "package");
2713
+ const packageDir = pkgDir || Path.join(info.contentPath, "package");
2725
2714
 
2726
2715
  const filter = (_file, _path, extras) => {
2727
2716
  const {
@@ -2751,11 +2740,40 @@ class FynCentral {
2751
2740
  return undefined;
2752
2741
  }
2753
2742
  }
2743
+ /**
2744
+ * Get the hash of a npm package's extracted content.
2745
+ * - only consider the file names and their mtime and size because npm tar files
2746
+ * with a fixed timestamp to publish, so the mtime give us some assurance
2747
+ * to know if file changed.
2748
+ *
2749
+ * @param {*} integrity - shasum integrity for the package
2750
+ * @returns void
2751
+ */
2752
+
2753
+
2754
+ async getContentShasum(integrity) {
2755
+ try {
2756
+ const info = await this.getInfo(integrity);
2757
+ return this._calcContentShasum(info);
2758
+ } catch (_err) {
2759
+ return undefined;
2760
+ }
2761
+ }
2754
2762
 
2755
2763
  async getMutation(integrity) {
2756
2764
  const info = this._map.has(integrity) ? this._map.get(integrity) : await this._loadTree(integrity);
2757
2765
  return info.mutates;
2758
2766
  }
2767
+
2768
+ async delete(integrity) {
2769
+ const info = this._map.get(integrity);
2770
+
2771
+ if (info && info.exist && info.contentPath) {
2772
+ await Fs.$.rimraf(info.contentPath);
2773
+
2774
+ this._map.delete(integrity);
2775
+ }
2776
+ }
2759
2777
  /**
2760
2778
  * Read the content dir tree from file into into
2761
2779
  *
@@ -2776,6 +2794,7 @@ class FynCentral {
2776
2794
  }
2777
2795
 
2778
2796
  info.tree = tree.$;
2797
+ info.shaSum = tree.shaSum;
2779
2798
  } else {
2780
2799
  info.tree = tree;
2781
2800
  }
@@ -2794,6 +2813,7 @@ class FynCentral {
2794
2813
  async saveInfoTree(info, path) {
2795
2814
  await Fs.writeFile(Path.join(path || info.contentPath, "tree.json"), JSON.stringify({
2796
2815
  $: info.tree,
2816
+ shaSum: info.shaSum,
2797
2817
  mutates: info.mutates,
2798
2818
  _: 1
2799
2819
  }));
@@ -2899,7 +2919,7 @@ class FynCentral {
2899
2919
  return tmpLock;
2900
2920
  }
2901
2921
 
2902
- async _storeTarStream(info, _stream) {
2922
+ async _storeTarStream(info, integrity, _stream) {
2903
2923
  let stream = _stream;
2904
2924
  const tmp = `${info.contentPath}.tmp`;
2905
2925
  await Fs.$.rimraf(tmp); // in case there was any remnant left from an interrupted install
@@ -2917,10 +2937,40 @@ class FynCentral {
2917
2937
 
2918
2938
 
2919
2939
  info.tree = await this._untarStream(stream, targetDir, info);
2940
+ info.shaSum = await this._calcContentShasum(info, targetDir);
2920
2941
  await this.saveInfoTree(info, tmp);
2921
2942
  await Fs.rename(tmp, info.contentPath);
2922
2943
  info.exist = true;
2923
2944
  }
2945
+ /**
2946
+ * Validate the central store package content by file size and timestamp
2947
+ *
2948
+ * @param {*} integrity - package integrity
2949
+ *
2950
+ * @returns true or false
2951
+ */
2952
+
2953
+
2954
+ async validate(integrity) {
2955
+ const info = this._map.get(integrity);
2956
+
2957
+ if (info === undefined || !info.exist) {
2958
+ return false;
2959
+ }
2960
+
2961
+ if (info.validated === undefined) {
2962
+ const sum = await this.getContentShasum(integrity);
2963
+
2964
+ if (!info.shaSum) {
2965
+ info.shaSum = sum;
2966
+ await this.saveInfoTree(info);
2967
+ }
2968
+
2969
+ info.validated = info.shaSum === sum;
2970
+ }
2971
+
2972
+ return info.validated;
2973
+ }
2924
2974
 
2925
2975
  async storeTarStream(pkgId, integrity, stream) {
2926
2976
  let tmpLock = false;
@@ -2948,7 +2998,7 @@ class FynCentral {
2948
2998
  }
2949
2999
  } else {
2950
3000
  logger.debug("storing tar to central store", pkgId, integrity);
2951
- await this._storeTarStream(info, stream);
3001
+ await this._storeTarStream(info, integrity, stream);
2952
3002
  stream = undefined; // eslint-disable-line
2953
3003
 
2954
3004
  this._map.set(integrity, info);
@@ -3121,9 +3171,8 @@ class Fyn {
3121
3171
  _cliSource = {},
3122
3172
  _fynpo = true
3123
3173
  }) {
3124
- this._cliSource = _cliSource;
3174
+ this._cliSource = _objectSpread({}, _cliSource);
3125
3175
  const options = this._options = fynConfig(opts);
3126
- this._layout = options.layout;
3127
3176
  this._cwd = options.cwd || process.cwd();
3128
3177
  logger.debug(`fyn options`, JSON.stringify(fynTil.removeAuthInfo(options)));
3129
3178
  this.localPkgWithNestedDep = [];
@@ -3145,11 +3194,49 @@ class Fyn {
3145
3194
  }
3146
3195
  }
3147
3196
 
3197
+ checkLayoutOption() {
3198
+ const {
3199
+ _options,
3200
+ _cliSource
3201
+ } = this;
3202
+
3203
+ if (_options.flattenTop === false && _cliSource.flattenTop !== "default") {
3204
+ //
3205
+ if (_options.layout !== "detail") {
3206
+ if (_cliSource.layout === "default") {
3207
+ logger.info(`flatten-top option turned off by ${_cliSource.flattenTop}, so switching node_modules layout to detail`);
3208
+ _options.layout = "detail";
3209
+ _cliSource.layout = _cliSource.flattenTop;
3210
+ } else {
3211
+ logger.warn(`you try to turn off flatten-top but set node_modules layout to ${_options.layout} and they are not compatible`);
3212
+ }
3213
+ }
3214
+ }
3215
+ }
3216
+
3148
3217
  checkFynLockExist() {
3149
3218
  const fname = Path.join(this._cwd, FYN_LOCK_FILE);
3150
3219
  return Fs.existsSync(fname);
3151
3220
  }
3152
3221
 
3222
+ updateConfigInLockfile(name, newValue) {
3223
+ const valueInLock = this._depLocker.getConfig(name);
3224
+
3225
+ if (valueInLock !== undefined && valueInLock !== newValue) {
3226
+ if (this._cliSource[name] === "cli") {
3227
+ logger.info(`You are changing ${name} in your lockfile from ${valueInLock} to ${newValue}`);
3228
+
3229
+ this._depLocker.setConfig(name, newValue);
3230
+ } else {
3231
+ logger.info(`Setting ${name} to ${valueInLock} from your lockfile`);
3232
+ this._options[name] = valueInLock;
3233
+ this._cliSource[name] = "lock";
3234
+ }
3235
+ } else {
3236
+ this._depLocker.setConfig(name, newValue);
3237
+ }
3238
+ }
3239
+
3153
3240
  async readLockFiles() {
3154
3241
  if (this._depLocker) {
3155
3242
  return null;
@@ -3158,20 +3245,9 @@ class Fyn {
3158
3245
  this._npmLockData = null;
3159
3246
  this._depLocker = new PkgDepLocker(this.lockOnly, this._options.lockfile);
3160
3247
  const foundLock = await this._depLocker.read(Path.join(this._cwd, FYN_LOCK_FILE));
3161
-
3162
- const layout = this._depLocker.getConfig("layout");
3163
-
3164
- if (layout && layout !== this._layout) {
3165
- if (this._cliSource.layout === "cli") {
3166
- logger.info(`You are changing layout in your lockfile from ${layout} to ${this._layout}`);
3167
-
3168
- this._depLocker.setConfig("layout", this._layout);
3169
- } else {
3170
- logger.info(`Setting layout to ${layout} from your lockfile`);
3171
- }
3172
- } else {
3173
- this._depLocker.setConfig("layout", this._layout);
3174
- }
3248
+ this.updateConfigInLockfile("layout", this._options.layout);
3249
+ this.updateConfigInLockfile("flattenTop", this._options.flattenTop);
3250
+ this.checkLayoutOption();
3175
3251
 
3176
3252
  if (this._options.npmLock === true) {// force load npm lock data
3177
3253
  } else if (foundLock || this._options.npmLock === false) {
@@ -3206,7 +3282,7 @@ class Fyn {
3206
3282
  }
3207
3283
 
3208
3284
  get isNormalLayout() {
3209
- return this._layout === "normal";
3285
+ return this._options.layout === "normal";
3210
3286
  }
3211
3287
 
3212
3288
  async _initCentralStore() {
@@ -3293,6 +3369,15 @@ class Fyn {
3293
3369
  return semv === false || semv && semv.includes("no-fyn-local");
3294
3370
  });
3295
3371
  return Boolean(noFynLocal);
3372
+ } // are we installing modules for the top level fynpo dir
3373
+
3374
+
3375
+ isTopLevelFynpoInstall() {
3376
+ if (this._fynpo.config) {
3377
+ return this._fynpo.dir === this._cwd;
3378
+ }
3379
+
3380
+ return false;
3296
3381
  }
3297
3382
 
3298
3383
  async _initializePkg() {
@@ -3300,10 +3385,10 @@ class Fyn {
3300
3385
  this._fynpo = await fynTil.loadFynpo(this._cwd); // TODO: options from CLI should not be override by fynpo config options
3301
3386
 
3302
3387
  _.merge(this._options, _.get(this, "_fynpo.fyn.options"));
3303
-
3304
- this._layout = this._options.layout;
3305
3388
  }
3306
3389
 
3390
+ this.checkLayoutOption();
3391
+
3307
3392
  if (!this._pkg) {
3308
3393
  const options = this._options;
3309
3394
  await this.loadPkg(options);
@@ -3366,12 +3451,15 @@ class Fyn {
3366
3451
 
3367
3452
  if (!_.isEmpty(resData)) {
3368
3453
  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;
3454
+ this._resolutionsMatchers = Object.keys(resData).map(depPath => {
3455
+ const unslashedPath = fynTil.unSlashNpmScope(depPath);
3456
+ const pts = unslashedPath.split("/"); // spec can only contain ** between slashes
3457
+
3458
+ assert(!pts.find(x => !(!x.includes("*") || x === "**")), `resolution path '${depPath}' can only contain '**' for wildcard matching`);
3459
+ const finalPath = pts.length === 1 ? `**/${unslashedPath}` : unslashedPath;
3372
3460
  return {
3373
- mm: new mm.Minimatch(x2),
3374
- res: resData[x]
3461
+ mm: new mm.Minimatch(finalPath),
3462
+ res: resData[depPath]
3375
3463
  };
3376
3464
  });
3377
3465
  }
@@ -4290,8 +4378,7 @@ module.exports = LifecycleScripts;
4290
4378
  *
4291
4379
  * - TODO: impl timestamp check so if no files updated then don't run
4292
4380
  */
4293
-
4294
- const assert = __webpack_require__("assert");
4381
+ // const assert = require("assert");
4295
4382
 
4296
4383
  const Path = __webpack_require__("path");
4297
4384
 
@@ -4426,13 +4513,12 @@ class LocalPkgBuilder {
4426
4513
  }
4427
4514
 
4428
4515
  async waitForItem(fullPath) {
4429
- if (this._waitItems[fullPath] === undefined) {
4516
+ if (this._waitItems[fullPath] === undefined && this._started.promise) {
4430
4517
  logger.debug("waiting for local build item start, fullPath:", fullPath);
4431
4518
  await this._started.promise;
4432
4519
  }
4433
4520
 
4434
- const x = this._waitItems[fullPath];
4435
- assert(x !== undefined, `No local pkg build job started for pkg at ${fullPath}`);
4521
+ const x = this._waitItems[fullPath]; // assert(x !== undefined, `No local pkg build job started for pkg at ${fullPath}`);
4436
4522
 
4437
4523
  if (x && x.promise) {
4438
4524
  logger.debug("waiting for build local item", fullPath, x);
@@ -4440,7 +4526,7 @@ class LocalPkgBuilder {
4440
4526
  logger.debug("build local item awaited", fullPath);
4441
4527
  return localBuildResult;
4442
4528
  } else {
4443
- logger.debug("status is false => no build local job for pkg at", fullPath, x);
4529
+ logger.debug("no build local job for pkg at", fullPath, x);
4444
4530
  }
4445
4531
 
4446
4532
  return {};
@@ -5885,13 +5971,14 @@ const {
5885
5971
 
5886
5972
  const {
5887
5973
  checkPkgOsCpu,
5888
- relativePath
5974
+ relativePath,
5975
+ unSlashNpmScope
5889
5976
  } = __webpack_require__("./lib/util/fyntil.js");
5890
5977
 
5891
5978
  const {
5892
5979
  getDepSection,
5893
5980
  makeDepStep
5894
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
5981
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/index.js");
5895
5982
 
5896
5983
  const xaa = __webpack_require__("./lib/util/xaa.js");
5897
5984
 
@@ -6156,7 +6243,22 @@ class PkgDepResolver {
6156
6243
  const depthPkgs = Object.keys(depthInfo); // TODO: create test scenario for build-local
6157
6244
 
6158
6245
  if (this._options.buildLocal) {
6159
- const locals = depthPkgs.map(x => depthInfo[x].items.find(it => it.localType)).filter(x => x); // logger.info("adding depth pkgs", depthPkgs.join(", "), locals);
6246
+ const locals = depthPkgs.map(x => depthInfo[x].items.find(it => it.localType)).filter(x => {
6247
+ // if fynpo top level depends on a local package that's part of the monorepo, then
6248
+ // we should not try to build the package while installing top level modules, because
6249
+ // building a local package would likely require build tools that are typically
6250
+ // installed as part of the top level packages
6251
+ if (x && this._fyn.isTopLevelFynpoInstall()) {
6252
+ const t1 = this._fyn._fynpo.graph.getPackageAtDir(Path.normalize(x.semverPath));
6253
+
6254
+ if (t1) {
6255
+ logger.info("installing fynpo top level modules - skip build local for package at", x.semverPath);
6256
+ return false;
6257
+ }
6258
+ }
6259
+
6260
+ return x;
6261
+ }); // logger.info("adding depth pkgs", depthPkgs.join(", "), locals);
6160
6262
 
6161
6263
  if (locals.length > 0) {
6162
6264
  if (!this._localsByDepth) {
@@ -6968,7 +7070,8 @@ ${item.depPath.join(" > ")}`);
6968
7070
  };
6969
7071
  }
6970
7072
  /**
6971
- * Match a nested dep to user's resolutions data
7073
+ * Match a nested dep to user's resolutions data, or nested and direct dep for packages
7074
+ * inside a fynpo monorepo.
6972
7075
  *
6973
7076
  * spec: https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
6974
7077
  *
@@ -6978,19 +7081,52 @@ ${item.depPath.join(" > ")}`);
6978
7081
 
6979
7082
 
6980
7083
  _replaceWithResolutionsData(item) {
6981
- if (item.depth < 2 || !this._fyn._resolutions || item._semver.$$) {
7084
+ if (!this._fyn._resolutions || item._semver.$$) {
6982
7085
  return undefined;
7086
+ } //
7087
+ // this item represent a direct dependency
7088
+ //
7089
+
7090
+
7091
+ if (item.depth < 2) {
7092
+ //
7093
+ // if we have a package within a fynpo monorepo, then we replace its direct
7094
+ // dependencies with resolutions data, vs only its nested dependencies
7095
+ // according to yarn's resolutions spec, because if local package A pull in
7096
+ // another local package B, then B's dependencies would end up being
7097
+ // subjected to resolutions data, so for consistency, we check resolutions
7098
+ // for all fynpo's local packages' direct dependencies.
7099
+ //
7100
+ if (!this._fyn.isFynpo) {
7101
+ // not a fynpo, avoid checking resolutions for direct dependencies
7102
+ return undefined;
7103
+ }
6983
7104
  }
6984
7105
 
6985
- const depPath = item.nameDepPath;
7106
+ let nameDepPath;
6986
7107
 
6987
- const found = this._fyn._resolutionsMatchers.find(r => r.mm.match(depPath));
7108
+ if (this._fyn.isFynpo) {
7109
+ nameDepPath = `${this._fyn._pkg.name}/${item.nameDepPath}`;
7110
+ } else {
7111
+ nameDepPath = item.nameDepPath;
7112
+ }
7113
+
7114
+ const unslashed = unSlashNpmScope(nameDepPath);
7115
+
7116
+ const found = this._fyn._resolutionsMatchers.find(r => r.mm.match(unslashed));
6988
7117
 
6989
- if (found) {
7118
+ if (found && found.res && found.res !== "--no-change" && found.res !== item.semver) {
6990
7119
  const {
6991
7120
  res
6992
7121
  } = found;
6993
- logger.debug(`${depPath} changed to ${res} from ${item.semver} by resolutions data`);
7122
+ const msg = `${nameDepPath} changed to ${res} from ${item.semver} by resolutions data`;
7123
+
7124
+ if (item.depth < 2) {
7125
+ logger.info(`fynpo: ${msg}`);
7126
+ } else {
7127
+ logger.debug(msg);
7128
+ }
7129
+
6994
7130
  semverUtil.replace(item._semver, res);
6995
7131
  }
6996
7132
 
@@ -8915,7 +9051,7 @@ const {
8915
9051
 
8916
9052
  const {
8917
9053
  PackageRef
8918
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
9054
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/index.js");
8919
9055
 
8920
9056
  const WATCH_TIME = 5000; // consider meta cache stale after this much time (30 minutes)
8921
9057
 
@@ -9101,7 +9237,7 @@ class PkgSrcManager {
9101
9237
  return readPkgJson(fullPath, true, true).then(json => {
9102
9238
  const publishUtilConfig = this.getPublishUtil(json, fullPath);
9103
9239
 
9104
- if (publishUtilConfig) {
9240
+ if (publishUtilConfig && !publishUtilConfig.fynIgnore) {
9105
9241
  logger.debug(`processing local package.json at ${fullPath} with https://www.npmjs.com/package/publish-util prePackObj`);
9106
9242
  prePackObj(json, _objectSpread(_objectSpread({}, publishUtilConfig), {}, {
9107
9243
  silent: true
@@ -9182,6 +9318,7 @@ class PkgSrcManager {
9182
9318
 
9183
9319
 
9184
9320
  const pacoteRequest = () => {
9321
+ logger.debug(`pacote.packument ${qItem.packumentUrl}`);
9185
9322
  return pacote.packument(pkgName, this.getPacoteOpts({
9186
9323
  "full-metadata": true,
9187
9324
  "fetch-retries": 3,
@@ -9402,6 +9539,7 @@ class PkgSrcManager {
9402
9539
  type: "meta",
9403
9540
  cacheKey,
9404
9541
  item,
9542
+ packumentUrl,
9405
9543
  defer: createDefer()
9406
9544
  };
9407
9545
 
@@ -9567,7 +9705,23 @@ class PkgSrcManager {
9567
9705
  } else if (!(await central.allow(integrity))) {
9568
9706
  logger.info(`copying pkg ${dispId} in central store mode because it mutates in postinstall step.`);
9569
9707
  } else {
9570
- const hasCentral = await central.has(integrity);
9708
+ let hasCentral = await central.has(integrity);
9709
+
9710
+ if (hasCentral) {
9711
+ const valid = await central.validate(integrity);
9712
+
9713
+ if (!valid) {
9714
+ const contentPath = await central.getContentPath(integrity);
9715
+ logger.error(`Corrupted central store package detected
9716
+ -- CORRUPTED CENTRAL STORE PACKAGE DETECTED, removing --
9717
+ ID: ${verId}
9718
+ integrity: ${integrity}
9719
+ path: '${contentPath}'
9720
+ `);
9721
+ await central.delete(integrity);
9722
+ hasCentral = false;
9723
+ }
9724
+ }
9571
9725
 
9572
9726
  if (!hasCentral) {
9573
9727
  await central.storeTarStream(tarId, integrity, tarStream);
@@ -9933,7 +10087,7 @@ const {
9933
10087
  const {
9934
10088
  FynpoConfigManager,
9935
10089
  FynpoDepGraph
9936
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js");
10090
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/index.js");
9937
10091
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
9938
10092
 
9939
10093
 
@@ -10238,6 +10392,17 @@ const fyntil = {
10238
10392
  },
10239
10393
  posixify,
10240
10394
 
10395
+ /**
10396
+ * Take a npm dependency path separated by / and replace the / that's meant for a npm scope with '+'
10397
+ *
10398
+ * @param {*} npmDepPath
10399
+ * @param {string} replacer string to replace the slash with
10400
+ * @returns dep path where npm scope's / replaced with '+'
10401
+ */
10402
+ unSlashNpmScope(npmDepPath, replacer = "+") {
10403
+ return npmDepPath.replace(/(\@[^\/]+)\//g, (_a, b) => `${b}${replacer}`);
10404
+ },
10405
+
10241
10406
  getGlobalNodeModules() {
10242
10407
  const nodeDir = Path.dirname(process.execPath);
10243
10408
 
@@ -11443,7 +11608,7 @@ module.exports = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa
11443
11608
 
11444
11609
  /***/ }),
11445
11610
 
11446
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/caching.js":
11611
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/caching.js":
11447
11612
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11448
11613
 
11449
11614
  "use strict";
@@ -11464,7 +11629,7 @@ const fs_1 = (0, tslib_1.__importDefault)(__webpack_require__("fs"));
11464
11629
  const path_1 = (0, tslib_1.__importDefault)(__webpack_require__("path"));
11465
11630
  const crypto_1 = (0, tslib_1.__importDefault)(__webpack_require__("crypto"));
11466
11631
 
11467
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11632
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11468
11633
  /**
11469
11634
  * create a sha256 hash for some data
11470
11635
  *
@@ -11732,7 +11897,7 @@ exports.processOutput = processOutput;
11732
11897
 
11733
11898
  /***/ }),
11734
11899
 
11735
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11900
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11736
11901
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11737
11902
 
11738
11903
  "use strict";
@@ -11882,7 +12047,7 @@ exports.FynpoConfigManager = FynpoConfigManager;
11882
12047
 
11883
12048
  /***/ }),
11884
12049
 
11885
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
12050
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11886
12051
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11887
12052
 
11888
12053
  "use strict";
@@ -11912,9 +12077,9 @@ const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_mod
11912
12077
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11913
12078
  const semver_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/semver/7.3.5/semver/index.js"));
11914
12079
 
11915
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12080
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11916
12081
 
11917
- const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js");
12082
+ const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/util.js");
11918
12083
 
11919
12084
  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"));
11920
12085
  const DepSectionMap = {
@@ -12095,18 +12260,23 @@ class FynpoDepGraph {
12095
12260
  };
12096
12261
  }
12097
12262
  /**
12098
- * resolve packages from fynpo
12263
+ * resolve packages from fynpo and resolve their dependency relations
12264
+ *
12265
+ * @param indirects - set true to resolve indirect deps also
12099
12266
  */
12100
12267
 
12101
12268
 
12102
- async resolve() {
12269
+ async resolve(indirects = false) {
12103
12270
  if (lodash_1.default.isEmpty(this.packages.byName)) {
12104
12271
  await this.readPackages();
12105
12272
  }
12106
12273
 
12107
- this.resolveDirectDeps(); // we don't need indirect deps
12108
- // topo sort works with only direct deps
12109
- // this.resolveIndirectDeps();
12274
+ this.resolveDirectDeps(); // default indirects to false because
12275
+ // topo sort requires only direct deps to work
12276
+
12277
+ if (indirects) {
12278
+ this.resolveIndirectDeps();
12279
+ }
12110
12280
  }
12111
12281
  /**
12112
12282
  * update package depdencies map
@@ -12125,16 +12295,30 @@ class FynpoDepGraph {
12125
12295
  * @returns array of paths of package dep data
12126
12296
  */
12127
12297
 
12298
+ /**
12299
+ * Return array of dep data sorted by dependency topological order
12300
+ *
12301
+ * @param avoidCircs - don't consider circular deps if `true`
12302
+ *
12303
+ * @returns array of paths of package dep data
12304
+ */
12305
+
12128
12306
 
12129
- getTopoSortPackagePaths() {
12307
+ getTopoSortPackagePaths(avoidCircs = false) {
12130
12308
  const depRecords = {};
12131
- const changed = []; //
12309
+ const changed = []; // don't take optionalDependecies or peerDependencies into consideration
12310
+ // TODO: also do not consider devDependencies
12311
+ // - should calculate detail circular dep info and return that for logging
12312
+ // - when fyn is about to do local build for a dep, it should check if there's
12313
+ // circular dep and avoid it.
12314
+
12315
+ const ignoreDepSections = ["opt", "peer"]; //
12132
12316
  // first start with packages that has zero local dependencies
12133
12317
  //
12134
12318
 
12135
12319
  for (const path in this.depMapByPath) {
12136
12320
  const depData = this.depMapByPath[path];
12137
- const count = Object.keys(depData.localDepsByPath).length;
12321
+ const count = Object.keys(depData.localDepsByPath).filter(k => !ignoreDepSections.includes(depData.localDepsByPath[k].depSection) && (!avoidCircs || !this.depMapByPath[depData.localDepsByPath[k].path].hasCircular)).length;
12138
12322
  depRecords[path] = {
12139
12323
  depData,
12140
12324
  count
@@ -12172,9 +12356,21 @@ class FynpoDepGraph {
12172
12356
  }
12173
12357
  }
12174
12358
 
12359
+ const circulars = Object.keys(depRecords).filter(path => depRecords[path].count > 0);
12360
+ let avoidCircSorted = [];
12361
+
12362
+ if (!avoidCircs && circulars.length > 0) {
12363
+ for (const p of circulars) {
12364
+ this.depMapByPath[p].hasCircular = true;
12365
+ }
12366
+
12367
+ avoidCircSorted = this.getTopoSortPackagePaths(true).sorted;
12368
+ }
12369
+
12175
12370
  return {
12176
12371
  sorted,
12177
- circulars: Object.keys(depRecords).filter(path => depRecords[path].count > 0)
12372
+ avoidCircSorted,
12373
+ circulars
12178
12374
  };
12179
12375
  }
12180
12376
  /**
@@ -12188,6 +12384,7 @@ class FynpoDepGraph {
12188
12384
  const topo = this.getTopoSortPackagePaths();
12189
12385
  return {
12190
12386
  sorted: topo.sorted.map(p => this.depMapByPath[p]),
12387
+ avoidCircSorted: topo.avoidCircSorted.map(p => this.depMapByPath[p]),
12191
12388
  circulars: topo.circulars.map(p => this.depMapByPath[p])
12192
12389
  };
12193
12390
  }
@@ -12643,7 +12840,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
12643
12840
 
12644
12841
  /***/ }),
12645
12842
 
12646
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/index.js":
12843
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/index.js":
12647
12844
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12648
12845
 
12649
12846
  "use strict";
@@ -12665,12 +12862,12 @@ const filter_scan_dir_1 = __webpack_require__("./node_modules/.f/_/filter-scan-d
12665
12862
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
12666
12863
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
12667
12864
 
12668
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12865
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12669
12866
 
12670
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12671
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12672
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12673
- exports.caching = (0, tslib_1.__importStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/caching.js"));
12867
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12868
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12869
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12870
+ exports.caching = (0, tslib_1.__importStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/caching.js"));
12674
12871
  /**
12675
12872
  * Take an array of packages and figure out their dependencies on each other
12676
12873
  *
@@ -12926,7 +13123,7 @@ exports.makePkgDeps = makePkgDeps;
12926
13123
 
12927
13124
  /***/ }),
12928
13125
 
12929
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
13126
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12930
13127
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12931
13128
 
12932
13129
  "use strict";
@@ -13065,7 +13262,7 @@ exports.unrollMmMatch = unrollMmMatch;
13065
13262
 
13066
13263
  /***/ }),
13067
13264
 
13068
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.15-fynlocal_h/@fynpo/base/dist/util.js":
13265
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.16-fynlocal_h/@fynpo/base/dist/util.js":
13069
13266
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13070
13267
 
13071
13268
  "use strict";
@@ -50161,7 +50358,7 @@ var gitHosts = module.exports = {
50161
50358
  'treepath': 'tree',
50162
50359
  'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
50163
50360
  'bugstemplate': 'https://{domain}/{user}/{project}/issues',
50164
- 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
50361
+ 'gittemplate': 'https://{auth@}{domain}/{user}/{project}.git{#committish}',
50165
50362
  'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}'
50166
50363
  },
50167
50364
  bitbucket: {
@@ -82778,18 +82975,19 @@ Fetcher.impl(fetchGit, {
82778
82975
  });
82779
82976
 
82780
82977
  function hostedManifest(spec, opts) {
82978
+ // try https:// first before git://
82781
82979
  return BB.resolve(null).then(() => {
82782
- if (!spec.hosted.git()) {
82783
- throw new Error(`No git url for ${spec}`);
82784
- }
82785
-
82786
- return plainManifest(spec.hosted.git(), spec, opts);
82787
- }).catch(err => {
82788
82980
  if (!spec.hosted.https()) {
82789
82981
  throw err;
82790
82982
  }
82791
82983
 
82792
82984
  return plainManifest(spec.hosted.https(), spec, opts);
82985
+ }).catch(err => {
82986
+ if (!spec.hosted.git()) {
82987
+ throw new Error(`No git url for ${spec}`);
82988
+ }
82989
+
82990
+ return plainManifest(spec.hosted.git(), spec, opts);
82793
82991
  }).catch(err => {
82794
82992
  if (!spec.hosted.sshurl()) {
82795
82993
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.37",
3
+ "version": "1.1.40",
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/",