fyn 1.1.18 → 1.1.19
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 +110 -18
- package/package.json +1 -1
package/dist/fyn.js
CHANGED
|
@@ -2923,7 +2923,7 @@ const semverUtil = __webpack_require__("./lib/util/semver.js");
|
|
|
2923
2923
|
|
|
2924
2924
|
const Fs = __webpack_require__("./lib/util/file-ops.js");
|
|
2925
2925
|
|
|
2926
|
-
const
|
|
2926
|
+
const fynTil = __webpack_require__("./lib/util/fyntil.js");
|
|
2927
2927
|
|
|
2928
2928
|
const FynCentral = __webpack_require__("./lib/fyn-central.js");
|
|
2929
2929
|
|
|
@@ -2980,7 +2980,7 @@ class Fyn {
|
|
|
2980
2980
|
const options = this._options = fynConfig(opts);
|
|
2981
2981
|
this._layout = options.layout;
|
|
2982
2982
|
this._cwd = options.cwd || process.cwd();
|
|
2983
|
-
logger.debug(`fyn options`, JSON.stringify(
|
|
2983
|
+
logger.debug(`fyn options`, JSON.stringify(fynTil.removeAuthInfo(options)));
|
|
2984
2984
|
this.localPkgWithNestedDep = [];
|
|
2985
2985
|
|
|
2986
2986
|
if (options.lockTime) {
|
|
@@ -3071,13 +3071,21 @@ class Fyn {
|
|
|
3071
3071
|
if (this._installConfig.centralDir) {
|
|
3072
3072
|
centralDir = this._installConfig.centralDir;
|
|
3073
3073
|
logger.debug(`Enabling central store using dir from install config ${centralDir}`);
|
|
3074
|
-
} else if (process.env.FYN_CENTRAL_DIR) {
|
|
3074
|
+
} else if (centralDir = process.env.FYN_CENTRAL_DIR) {
|
|
3075
3075
|
// env wins
|
|
3076
|
-
centralDir
|
|
3077
|
-
|
|
3076
|
+
if (fynTil.strToBool(centralDir) === false) {
|
|
3077
|
+
logger.debug(`Disabling central store by env FYN_CENTRAL_DIR set to ${centralDir}`);
|
|
3078
|
+
return this._central = false;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
if (fynTil.isTrueStr(centralDir)) {
|
|
3082
|
+
centralDir = Path.join(this.fynDir, "_central-storage");
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
logger.debug(`Enabling central store by env FYN_CENTRAL_DIR using dir ${centralDir}`);
|
|
3078
3086
|
} else if (options.centralStore) {
|
|
3079
3087
|
centralDir = Path.join(this.fynDir, "_central-storage");
|
|
3080
|
-
logger.debug(`Enabling central store
|
|
3088
|
+
logger.debug(`Enabling central store by CLI flag using dir ${centralDir}`);
|
|
3081
3089
|
} else if (!this._fynpo.config) {
|
|
3082
3090
|
return this._central = false;
|
|
3083
3091
|
} else {
|
|
@@ -3087,7 +3095,7 @@ class Fyn {
|
|
|
3087
3095
|
centralDir = Path.join(this._fynpo.dir, ".fynpo", "_store");
|
|
3088
3096
|
}
|
|
3089
3097
|
|
|
3090
|
-
logger.info(`fynpo monorepo
|
|
3098
|
+
logger.info(`Enabling central store by fynpo monorepo using dir ${centralDir}`);
|
|
3091
3099
|
}
|
|
3092
3100
|
|
|
3093
3101
|
return this._central = new FynCentral({
|
|
@@ -3144,7 +3152,7 @@ class Fyn {
|
|
|
3144
3152
|
|
|
3145
3153
|
async _initializePkg() {
|
|
3146
3154
|
if (!this._fynpo) {
|
|
3147
|
-
this._fynpo = await
|
|
3155
|
+
this._fynpo = await fynTil.loadFynpo(this._cwd); // TODO: options from CLI should not be override by fynpo config options
|
|
3148
3156
|
|
|
3149
3157
|
_.merge(this._options, _.get(this, "_fynpo.fyn.options"));
|
|
3150
3158
|
|
|
@@ -3242,7 +3250,7 @@ class Fyn {
|
|
|
3242
3250
|
retryWait: 500
|
|
3243
3251
|
});
|
|
3244
3252
|
const path = posixify(Path.relative(this._fynpo.dir, this.cwd));
|
|
3245
|
-
const fynpoData = await
|
|
3253
|
+
const fynpoData = await fynTil.readJson(dataFile, {
|
|
3246
3254
|
indirects: {
|
|
3247
3255
|
[path]: []
|
|
3248
3256
|
}
|
|
@@ -3332,7 +3340,7 @@ class Fyn {
|
|
|
3332
3340
|
}
|
|
3333
3341
|
|
|
3334
3342
|
async loadPkgFyn() {
|
|
3335
|
-
this._pkgFyn = await xaa.try(() =>
|
|
3343
|
+
this._pkgFyn = await xaa.try(() => fynTil.readJson(Path.resolve(this._cwd, PACKAGE_FYN_JSON)));
|
|
3336
3344
|
return this._pkgFyn;
|
|
3337
3345
|
}
|
|
3338
3346
|
|
|
@@ -3353,11 +3361,11 @@ class Fyn {
|
|
|
3353
3361
|
this._pkgFile = pkgFile;
|
|
3354
3362
|
|
|
3355
3363
|
try {
|
|
3356
|
-
this._pkg = await
|
|
3364
|
+
this._pkg = await fynTil.readPkgJson(pkgFile, true);
|
|
3357
3365
|
} catch (err) {
|
|
3358
3366
|
logger.error("failed to read package.json file", pkgFile);
|
|
3359
3367
|
logger.error(err.message);
|
|
3360
|
-
|
|
3368
|
+
fynTil.exit(err);
|
|
3361
3369
|
}
|
|
3362
3370
|
|
|
3363
3371
|
const pkgFyn = await this.loadPkgFyn(options);
|
|
@@ -3860,7 +3868,7 @@ class Fyn {
|
|
|
3860
3868
|
|
|
3861
3869
|
async loadJsonForPkg(pkg, dir) {
|
|
3862
3870
|
const fullOutDir = dir || this.getInstalledPkgDir(pkg.name, pkg.version, pkg);
|
|
3863
|
-
const json = await
|
|
3871
|
+
const json = await fynTil.readPkgJson(fullOutDir, true);
|
|
3864
3872
|
const pkgId = `${pkg.name}@${pkg.version}`;
|
|
3865
3873
|
const id = `${json.name}@${json.version}`;
|
|
3866
3874
|
|
|
@@ -7702,7 +7710,7 @@ class PkgInstaller {
|
|
|
7702
7710
|
const vdir = this._fyn.getInstalledPkgDir(depInfo.name, depInfo.version, depInfo);
|
|
7703
7711
|
|
|
7704
7712
|
pkgJsonFp = Path.join(vdir, "package.json");
|
|
7705
|
-
await Fs.unlink(pkgJsonFp);
|
|
7713
|
+
await xaa.try(() => Fs.unlink(pkgJsonFp));
|
|
7706
7714
|
} else {
|
|
7707
7715
|
pkgJsonFp = Path.join(depInfo.dir, "package.json");
|
|
7708
7716
|
}
|
|
@@ -10021,6 +10029,46 @@ const fyntil = {
|
|
|
10021
10029
|
|
|
10022
10030
|
return true;
|
|
10023
10031
|
},
|
|
10032
|
+
|
|
10033
|
+
/**
|
|
10034
|
+
* Convert a string to a bool value. Considering 0, off, false, no to be `false`, else true.
|
|
10035
|
+
*
|
|
10036
|
+
* @param {*} v
|
|
10037
|
+
* @returns true or false
|
|
10038
|
+
*/
|
|
10039
|
+
strToBool: v => {
|
|
10040
|
+
if (!v) {
|
|
10041
|
+
return false;
|
|
10042
|
+
}
|
|
10043
|
+
|
|
10044
|
+
const lv = v.toLowerCase();
|
|
10045
|
+
|
|
10046
|
+
if (lv === "0" || lv === "off" || lv === "false" || lv === "no") {
|
|
10047
|
+
return false;
|
|
10048
|
+
}
|
|
10049
|
+
|
|
10050
|
+
return true;
|
|
10051
|
+
},
|
|
10052
|
+
|
|
10053
|
+
/**
|
|
10054
|
+
* Check if a string looks like a true bool value, considering 1, on, true, yes to be `true`, else `false`
|
|
10055
|
+
*
|
|
10056
|
+
* @param {*} v
|
|
10057
|
+
* @returns true or false
|
|
10058
|
+
*/
|
|
10059
|
+
isTrueStr: v => {
|
|
10060
|
+
if (!v) {
|
|
10061
|
+
return false;
|
|
10062
|
+
}
|
|
10063
|
+
|
|
10064
|
+
const lv = v.toLowerCase();
|
|
10065
|
+
|
|
10066
|
+
if (lv === "1" || lv === "on" || lv === "true" || lv === "yes") {
|
|
10067
|
+
return true;
|
|
10068
|
+
}
|
|
10069
|
+
|
|
10070
|
+
return false;
|
|
10071
|
+
},
|
|
10024
10072
|
posixify
|
|
10025
10073
|
};
|
|
10026
10074
|
module.exports = fyntil;
|
|
@@ -10058,6 +10106,18 @@ const {
|
|
|
10058
10106
|
} = __webpack_require__("./node_modules/.f/_/source-map/0.7.3/source-map/source-map.js");
|
|
10059
10107
|
|
|
10060
10108
|
const ci = __webpack_require__("./node_modules/.f/_/ci-info/2.0.0/ci-info/index.js");
|
|
10109
|
+
/**
|
|
10110
|
+
* Hard link a file
|
|
10111
|
+
*
|
|
10112
|
+
* - if the link exist and is link to a different file, then remove it
|
|
10113
|
+
* and create a new link that points to the new file.
|
|
10114
|
+
*
|
|
10115
|
+
* @param {*} srcFp
|
|
10116
|
+
* @param {*} destFp
|
|
10117
|
+
* @param {*} srcStat
|
|
10118
|
+
* @returns
|
|
10119
|
+
*/
|
|
10120
|
+
|
|
10061
10121
|
|
|
10062
10122
|
async function linkFile(srcFp, destFp, srcStat) {
|
|
10063
10123
|
try {
|
|
@@ -10080,6 +10140,13 @@ async function linkFile(srcFp, destFp, srcStat) {
|
|
|
10080
10140
|
|
|
10081
10141
|
return undefined;
|
|
10082
10142
|
}
|
|
10143
|
+
/**
|
|
10144
|
+
* Copy a file
|
|
10145
|
+
* @param {*} srcFp
|
|
10146
|
+
* @param {*} destFp
|
|
10147
|
+
* @returns
|
|
10148
|
+
*/
|
|
10149
|
+
|
|
10083
10150
|
|
|
10084
10151
|
async function copyFile(srcFp, destFp) {
|
|
10085
10152
|
if (Fs.copyFile) {
|
|
@@ -10120,10 +10187,17 @@ async function cleanExtraDest(dest, destFiles) {
|
|
|
10120
10187
|
}
|
|
10121
10188
|
|
|
10122
10189
|
const FILES = Symbol("files");
|
|
10190
|
+
/**
|
|
10191
|
+
* Generate a tree of files using npm-pack that a package would publish with.
|
|
10192
|
+
*
|
|
10193
|
+
* @param {*} path
|
|
10194
|
+
* @returns
|
|
10195
|
+
*/
|
|
10123
10196
|
|
|
10124
10197
|
async function generatePackTree(path) {
|
|
10125
10198
|
const files = await npmPacklist({
|
|
10126
|
-
path
|
|
10199
|
+
path,
|
|
10200
|
+
includeSymlinks: fynTil.strToBool(process.env.FYN_LOCAL_PACK_SYMLINKS)
|
|
10127
10201
|
});
|
|
10128
10202
|
logger.debug(`local package linking - pack tree returned ${files.length} files to link`, JSON.stringify(files, null, 2));
|
|
10129
10203
|
|
|
@@ -10181,7 +10255,9 @@ function getSourceMapConfig(content, sig = SOURCE_MAP_URL_SIG) {
|
|
|
10181
10255
|
return lastMatch && lastMatch[1];
|
|
10182
10256
|
}
|
|
10183
10257
|
/**
|
|
10184
|
-
* process or generate source map back to original file
|
|
10258
|
+
* process or generate source map back to original file.
|
|
10259
|
+
*
|
|
10260
|
+
* - Do nothing if in CI mode
|
|
10185
10261
|
*
|
|
10186
10262
|
* @param {*} param0
|
|
10187
10263
|
*/
|
|
@@ -10298,6 +10374,8 @@ async function handleSourceMap({
|
|
|
10298
10374
|
/**
|
|
10299
10375
|
* Link tree of files generated from npm pack
|
|
10300
10376
|
*
|
|
10377
|
+
* - if env `FYN_LOCAL_COPY_MODE` is defined, then copy file instead of linking
|
|
10378
|
+
*
|
|
10301
10379
|
* @param {*} tree
|
|
10302
10380
|
* @param {*} src
|
|
10303
10381
|
* @param {*} dest
|
|
@@ -10327,7 +10405,13 @@ async function linkPackTree({
|
|
|
10327
10405
|
destFiles[file] = true;
|
|
10328
10406
|
const srcFp = Path.join(src, file);
|
|
10329
10407
|
const destFp = Path.join(dest, file);
|
|
10330
|
-
|
|
10408
|
+
|
|
10409
|
+
if (fynTil.strToBool(process.env.FYN_LOCAL_COPY_MODE)) {
|
|
10410
|
+
await copyFile(srcFp, destFp);
|
|
10411
|
+
} else {
|
|
10412
|
+
await linkFile(srcFp, destFp);
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10331
10415
|
await handleSourceMap({
|
|
10332
10416
|
file,
|
|
10333
10417
|
destFiles,
|
|
@@ -55025,6 +55109,14 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
55025
55109
|
this.bundledScopes = [];
|
|
55026
55110
|
this.packageJsonCache = this.parent.packageJsonCache;
|
|
55027
55111
|
}
|
|
55112
|
+
|
|
55113
|
+
this.includeSymlinks = opt.includeSymlinks;
|
|
55114
|
+
}
|
|
55115
|
+
|
|
55116
|
+
walkerOpt(entry) {
|
|
55117
|
+
const opt = super.walkerOpt(entry);
|
|
55118
|
+
opt.includeSymlinks = this.includeSymlinks;
|
|
55119
|
+
return opt;
|
|
55028
55120
|
}
|
|
55029
55121
|
|
|
55030
55122
|
onReaddir(entries) {
|
|
@@ -55101,7 +55193,7 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
55101
55193
|
|
|
55102
55194
|
|
|
55103
55195
|
onstat(st, entry, file, dir, then) {
|
|
55104
|
-
if (st.isSymbolicLink()) then();else super.onstat(st, entry, file, dir, then);
|
|
55196
|
+
if (!this.includeSymlinks && st.isSymbolicLink()) then();else super.onstat(st, entry, file, dir, then);
|
|
55105
55197
|
}
|
|
55106
55198
|
|
|
55107
55199
|
onReadIgnoreFile(file, data, then) {
|
package/package.json
CHANGED