fyn 1.1.17 → 1.1.18

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 +45 -32
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -3796,14 +3796,23 @@ class Fyn {
3796
3796
  }
3797
3797
  }
3798
3798
 
3799
- async moveToBackup(dir, reason) {
3800
- // TODO: create backup dir and move
3801
- logger.warn("Removing", dir, "due to", reason);
3802
- return await Fs.$.rimraf(dir);
3799
+ async moveToFv(dir, pkg, pkgJson) {
3800
+ const toDir = this.getInstalledPkgDir(pkgJson.name, pkgJson.version, {});
3801
+
3802
+ try {
3803
+ await Fs.access(toDir); // a copy already exist in FV dir, so remove it
3804
+
3805
+ logger.warn(`Removing ${dir} because its version ${pkgJson.version} is different from ${pkg.version}`);
3806
+ await Fs.$.rimraf(dir);
3807
+ } catch (err) {
3808
+ logger.debug(`Moving ${dir} to ${toDir} to replace with version ${pkg.version}`);
3809
+ await Fs.$.mkdirp(Path.dirname(toDir));
3810
+ await Fs.rename(dir, toDir);
3811
+ }
3803
3812
  }
3804
3813
 
3805
- async unlinkLocalPackage(pkg, dir) {
3806
- logger.warn("Removing symlink", dir);
3814
+ async unlinkLocalPackage(dir, reason) {
3815
+ logger.warn(`Removing ${dir} because it's ${reason}`);
3807
3816
  return await Fs.$.rimraf(dir);
3808
3817
  } //
3809
3818
  // A pkg that's to be extracted must:
@@ -3829,21 +3838,21 @@ class Fyn {
3829
3838
  }
3830
3839
 
3831
3840
  if (ostat.isSymbolicLink()) {
3832
- await this.unlinkLocalPackage(pkg, fullOutDir);
3841
+ await this.unlinkLocalPackage(fullOutDir, "a symlink");
3833
3842
  } else if (!ostat.isDirectory()) {
3834
- await this.moveToBackup(fullOutDir, "not a directory");
3843
+ await this.unlinkLocalPackage(fullOutDir, "not a directory");
3835
3844
  } else {
3836
3845
  try {
3837
3846
  const pkgJson = await this.loadJsonForPkg(pkg, fullOutDir);
3838
3847
 
3839
3848
  if (!pkgJson._invalid) {
3840
3849
  return pkgJson;
3841
- } // no valid package.json found
3842
-
3850
+ }
3843
3851
 
3844
- const id = pkgJson._id ? ` (id ${pkgJson._id})` : "";
3845
- await this.moveToBackup(fullOutDir, `invalid existing package${id}`);
3846
- } catch (err) {}
3852
+ await this.moveToFv(fullOutDir, pkg, pkgJson);
3853
+ } catch (err) {
3854
+ logger.warn(`ensureProperPkgdir:`, err);
3855
+ }
3847
3856
  }
3848
3857
 
3849
3858
  return null;
@@ -5763,7 +5772,7 @@ const {
5763
5772
  const {
5764
5773
  getDepSection,
5765
5774
  makeDepStep
5766
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/index.js");
5775
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
5767
5776
 
5768
5777
  const xaa = __webpack_require__("./lib/util/xaa.js");
5769
5778
 
@@ -6849,7 +6858,7 @@ ${item.depPath.join(" > ")}`);
6849
6858
  return false;
6850
6859
  }
6851
6860
 
6852
- const force = this._lockOnly && isOpt; // check if an already resolved local package satisfies item
6861
+ const force = this._lockOnly && !isOpt; // check if an already resolved local package satisfies item
6853
6862
  // before trying to resolve with lock data
6854
6863
 
6855
6864
  if (!this._fyn.preferLock) {
@@ -8070,13 +8079,17 @@ class PkgInstaller {
8070
8079
 
8071
8080
  if (scope) await xaa.try(() => Fs.rmdir(Path.join(outDir, scope))); // get rid of potentially empty FV_DIR dir
8072
8081
 
8073
- await xaa.try(() => Fs.rmdir(this._fyn.getFvDir()));
8082
+ await xaa.try(() => Fs.rmdir(this._fyn.getFvDir("_")));
8074
8083
  }
8075
8084
  /**
8076
8085
  * Process detail layout for node_modules.
8077
8086
  *
8078
- * Make links under node_modules for packages that exist app's package.json and
8079
- * flattened packages under node_modules/${FV_DIR}/node_modules
8087
+ * Real copies of packages are store under FV_DIR.
8088
+ *
8089
+ * 1. For top level packages that exist in app's package.json, make symlinks under node_modules.
8090
+ * 2. For packages that could be promoted to the top level:
8091
+ * - If flattenTop enabled, make symlinks under node_modules
8092
+ * - flattenTop disabled, make symlinks under FV_Dir/node_modules
8080
8093
  *
8081
8094
  * @returns {*} none
8082
8095
  */
@@ -8729,7 +8742,7 @@ const {
8729
8742
 
8730
8743
  const {
8731
8744
  PackageRef
8732
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/index.js");
8745
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
8733
8746
 
8734
8747
  const WATCH_TIME = 5000; // consider meta cache stale after this much time (30 minutes)
8735
8748
 
@@ -8916,7 +8929,7 @@ class PkgSrcManager {
8916
8929
  const publishUtilConfig = this.getPublishUtil(json, fullPath);
8917
8930
 
8918
8931
  if (publishUtilConfig) {
8919
- logger.info(`processing local package.json at ${fullPath} with https://www.npmjs.com/package/publish-util prePackObj`);
8932
+ logger.debug(`processing local package.json at ${fullPath} with https://www.npmjs.com/package/publish-util prePackObj`);
8920
8933
  prePackObj(json, _objectSpread(_objectSpread({}, publishUtilConfig), {}, {
8921
8934
  silent: true
8922
8935
  }));
@@ -9745,7 +9758,7 @@ const {
9745
9758
  const {
9746
9759
  FynpoConfigManager,
9747
9760
  FynpoDepGraph
9748
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/index.js");
9761
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
9749
9762
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
9750
9763
 
9751
9764
 
@@ -11002,7 +11015,7 @@ module.exports = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa
11002
11015
 
11003
11016
  /***/ }),
11004
11017
 
11005
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11018
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11006
11019
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11007
11020
 
11008
11021
  "use strict";
@@ -11152,7 +11165,7 @@ exports.FynpoConfigManager = FynpoConfigManager;
11152
11165
 
11153
11166
  /***/ }),
11154
11167
 
11155
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11168
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11156
11169
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11157
11170
 
11158
11171
  "use strict";
@@ -11181,9 +11194,9 @@ const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_mod
11181
11194
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11182
11195
  const semver_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/semver/7.3.5/semver/index.js"));
11183
11196
 
11184
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11197
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11185
11198
 
11186
- const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/util.js");
11199
+ const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js");
11187
11200
 
11188
11201
  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"));
11189
11202
  const DepSectionMap = {
@@ -11903,7 +11916,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
11903
11916
 
11904
11917
  /***/ }),
11905
11918
 
11906
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/index.js":
11919
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js":
11907
11920
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11908
11921
 
11909
11922
  "use strict";
@@ -11924,11 +11937,11 @@ const filter_scan_dir_1 = (0, tslib_1.__importDefault)(__webpack_require__("./no
11924
11937
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
11925
11938
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11926
11939
 
11927
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11940
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11928
11941
 
11929
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
11930
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
11931
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/util.js"), exports);
11942
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
11943
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
11944
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js"), exports);
11932
11945
  /**
11933
11946
  * Take an array of packages and figure out their dependencies on each other
11934
11947
  *
@@ -12183,7 +12196,7 @@ exports.makePkgDeps = makePkgDeps;
12183
12196
 
12184
12197
  /***/ }),
12185
12198
 
12186
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12199
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12187
12200
  /***/ ((__unused_webpack_module, exports) => {
12188
12201
 
12189
12202
  "use strict";
@@ -12229,7 +12242,7 @@ exports.groupMM = groupMM;
12229
12242
 
12230
12243
  /***/ }),
12231
12244
 
12232
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.6-fynlocal_h/@fynpo/base/dist/util.js":
12245
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js":
12233
12246
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12234
12247
 
12235
12248
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "A node package manager, fast, workspace, and better productivity and efficiency",
5
5
  "main": "./bin/fyn.js",
6
6
  "homepage": "https://www.electrode.io/fynpo/",