fyn 1.1.32 → 1.1.35
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 +176 -46
- package/package.json +1 -1
package/dist/fyn.js
CHANGED
|
@@ -542,6 +542,8 @@ const {
|
|
|
542
542
|
setupNodeGypEnv
|
|
543
543
|
} = __webpack_require__("./lib/util/setup-node-gyp.js");
|
|
544
544
|
|
|
545
|
+
const hardLinkDir = __webpack_require__("./lib/util/hard-link-dir.js");
|
|
546
|
+
|
|
545
547
|
const xsh = __webpack_require__("./node_modules/.f/_/xsh/0.4.5/xsh/lib/index.js");
|
|
546
548
|
|
|
547
549
|
function checkNewVersion(npmConfig) {
|
|
@@ -864,6 +866,27 @@ class FynCli {
|
|
|
864
866
|
logger.error("No package was removed");
|
|
865
867
|
return false;
|
|
866
868
|
}
|
|
869
|
+
|
|
870
|
+
async syncLocalLinks() {
|
|
871
|
+
await this.fyn._initializePkg();
|
|
872
|
+
const {
|
|
873
|
+
localPkgLinks
|
|
874
|
+
} = this.fyn._installConfig;
|
|
875
|
+
|
|
876
|
+
if (!_.isEmpty(localPkgLinks)) {
|
|
877
|
+
for (const vdir in localPkgLinks) {
|
|
878
|
+
const tgtDir = Path.join(this.fyn._cwd, vdir);
|
|
879
|
+
const srcDir = Path.join(this.fyn._cwd, localPkgLinks[vdir].srcDir);
|
|
880
|
+
await hardLinkDir.link(srcDir, tgtDir, {
|
|
881
|
+
sourceMaps: localPkgLinks[vdir].sourceMaps
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
logger.info(`refreshed linked files for local packages`);
|
|
886
|
+
} else {
|
|
887
|
+
logger.info(`There are no local packages`);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
867
890
|
/*
|
|
868
891
|
* npm scripts execution order on install
|
|
869
892
|
* 1. preinstall
|
|
@@ -1146,7 +1169,31 @@ const defaultRc = __webpack_require__("./cli/default-rc.js");
|
|
|
1146
1169
|
|
|
1147
1170
|
const npmConfig = __webpack_require__("./cli/config/npm-config.js");
|
|
1148
1171
|
|
|
1149
|
-
const fynTil = __webpack_require__("./lib/util/fyntil.js");
|
|
1172
|
+
const fynTil = __webpack_require__("./lib/util/fyntil.js"); // replace any ${ENV} values with the appropriate environ.
|
|
1173
|
+
// copied from https://github.com/npm/config/blob/1f47a6c6ae7864b412d45c6a4a74930cf3365395/lib/env-replace.js
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
const envExpr = /(?<!\\)(\\*)\$\{([^${}]+)\}/g;
|
|
1177
|
+
|
|
1178
|
+
function replaceEnv(f, env) {
|
|
1179
|
+
return f.replace(envExpr, (orig, esc, name) => {
|
|
1180
|
+
const val = env[name] !== undefined ? env[name] : `$\{${name}}`; // consume the escape chars that are relevant.
|
|
1181
|
+
|
|
1182
|
+
if (esc.length % 2) {
|
|
1183
|
+
return orig.slice((esc.length + 1) / 2);
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
return esc.slice(esc.length / 2) + val;
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
function replaceRcEnv(rc, env) {
|
|
1191
|
+
for (const k in rc) {
|
|
1192
|
+
if (rc[k] && rc[k].replace) {
|
|
1193
|
+
rc[k] = replaceEnv(rc[k], env);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1150
1197
|
|
|
1151
1198
|
function readRc(fname) {
|
|
1152
1199
|
const rcFname = Path.basename(fname);
|
|
@@ -1200,6 +1247,8 @@ function loadRc(cwd, fynpoDir) {
|
|
|
1200
1247
|
|
|
1201
1248
|
const npmrc = _.merge.apply(_, [{}, npmConfig.defaults].concat(npmrcData));
|
|
1202
1249
|
|
|
1250
|
+
replaceRcEnv(all, process.env);
|
|
1251
|
+
replaceRcEnv(npmrc, process.env);
|
|
1203
1252
|
return {
|
|
1204
1253
|
all,
|
|
1205
1254
|
npmrc,
|
|
@@ -1645,6 +1694,21 @@ const commands = {
|
|
|
1645
1694
|
type: "boolean"
|
|
1646
1695
|
}
|
|
1647
1696
|
}
|
|
1697
|
+
},
|
|
1698
|
+
"sync-local": {
|
|
1699
|
+
desc: "Refresh locally linked package files",
|
|
1700
|
+
alias: "sl",
|
|
1701
|
+
|
|
1702
|
+
async exec(argv, parsed) {
|
|
1703
|
+
try {
|
|
1704
|
+
const opts = await pickOptions(argv, parsed.nixClap, true);
|
|
1705
|
+
const cli = new FynCli(opts);
|
|
1706
|
+
return cli.syncLocalLinks();
|
|
1707
|
+
} catch (err) {
|
|
1708
|
+
process.exit(1);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1648
1712
|
}
|
|
1649
1713
|
};
|
|
1650
1714
|
|
|
@@ -2506,6 +2570,7 @@ const Crypto = __webpack_require__("crypto");
|
|
|
2506
2570
|
* ]
|
|
2507
2571
|
* }
|
|
2508
2572
|
* ```
|
|
2573
|
+
*
|
|
2509
2574
|
* @param {*} tree - the dir tree
|
|
2510
2575
|
* @param {*} output - output object
|
|
2511
2576
|
* @param {*} baseDir - base dir path
|
|
@@ -2648,7 +2713,7 @@ class FynCentral {
|
|
|
2648
2713
|
* to know if file changed.
|
|
2649
2714
|
*
|
|
2650
2715
|
* @param {*} integrity - shasum integrity for the package
|
|
2651
|
-
* @returns
|
|
2716
|
+
* @returns void
|
|
2652
2717
|
*/
|
|
2653
2718
|
|
|
2654
2719
|
|
|
@@ -2776,9 +2841,16 @@ class FynCentral {
|
|
|
2776
2841
|
}
|
|
2777
2842
|
|
|
2778
2843
|
_untarStream(tarStream, targetDir) {
|
|
2779
|
-
|
|
2780
|
-
|
|
2844
|
+
// since we are using objects to store directory tree we have to
|
|
2845
|
+
// create objects without the normal prototypes to avoid name conflict
|
|
2846
|
+
// with file names
|
|
2847
|
+
const newDirObj = () => {
|
|
2848
|
+
const n = Object.create(null);
|
|
2849
|
+
n["/"] = Object.create(null);
|
|
2850
|
+
return n;
|
|
2781
2851
|
};
|
|
2852
|
+
|
|
2853
|
+
const dirTree = newDirObj();
|
|
2782
2854
|
const strip = 1;
|
|
2783
2855
|
const untarStream = Tar.x({
|
|
2784
2856
|
strip,
|
|
@@ -2789,9 +2861,7 @@ class FynCentral {
|
|
|
2789
2861
|
const isDir = entry.type === "Directory";
|
|
2790
2862
|
const dirs = parts.slice(strip, isDir ? parts.length : parts.length - 1);
|
|
2791
2863
|
const wtree = dirs.reduce((wt, dir) => {
|
|
2792
|
-
return wt[dir] || (wt[dir] =
|
|
2793
|
-
"/": {}
|
|
2794
|
-
});
|
|
2864
|
+
return wt[dir] || (wt[dir] = newDirObj());
|
|
2795
2865
|
}, dirTree);
|
|
2796
2866
|
if (isDir) return;
|
|
2797
2867
|
const fname = parts[parts.length - 1];
|
|
@@ -2878,7 +2948,7 @@ class FynCentral {
|
|
|
2878
2948
|
} else {
|
|
2879
2949
|
logger.debug("storing tar to central store", pkgId, integrity);
|
|
2880
2950
|
await this._storeTarStream(info, stream);
|
|
2881
|
-
stream = undefined;
|
|
2951
|
+
stream = undefined; // eslint-disable-line
|
|
2882
2952
|
|
|
2883
2953
|
this._map.set(integrity, info);
|
|
2884
2954
|
|
|
@@ -3376,6 +3446,10 @@ class Fyn {
|
|
|
3376
3446
|
|
|
3377
3447
|
getInstallConfigFile() {
|
|
3378
3448
|
return Path.join(this.getFvDir(FYN_INSTALL_CONFIG_FILE));
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
setLocalPkgLinks(localLinks) {
|
|
3452
|
+
this._installConfig.localPkgLinks = localLinks;
|
|
3379
3453
|
} // save the config to outputDir
|
|
3380
3454
|
|
|
3381
3455
|
|
|
@@ -3709,7 +3783,7 @@ class Fyn {
|
|
|
3709
3783
|
* - Rare but could occur if fyn is used for monorepo and user has script
|
|
3710
3784
|
* that run concurrent installs
|
|
3711
3785
|
*
|
|
3712
|
-
* @returns {boolean} if lock was acquired
|
|
3786
|
+
* @returns {Promise<boolean>} if lock was acquired
|
|
3713
3787
|
*/
|
|
3714
3788
|
|
|
3715
3789
|
|
|
@@ -4048,6 +4122,10 @@ const {
|
|
|
4048
4122
|
|
|
4049
4123
|
const npmConfigEnv = __webpack_require__("./lib/util/npm-config-env.js");
|
|
4050
4124
|
|
|
4125
|
+
const {
|
|
4126
|
+
AggregateError
|
|
4127
|
+
} = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
|
|
4128
|
+
|
|
4051
4129
|
const readPkgJson = dir => {
|
|
4052
4130
|
return fyntil.readPkgJson(dir).catch(() => {
|
|
4053
4131
|
return {};
|
|
@@ -4169,7 +4247,12 @@ class LifecycleScripts {
|
|
|
4169
4247
|
logLabel: `${pkgName} npm script ${scriptName}`,
|
|
4170
4248
|
outputLabel: `${dimPkgName} npm script ${scriptName}`
|
|
4171
4249
|
});
|
|
4172
|
-
|
|
4250
|
+
|
|
4251
|
+
try {
|
|
4252
|
+
return await ve.show(child);
|
|
4253
|
+
} catch (err) {
|
|
4254
|
+
throw new AggregateError([err], `Failed running npm script '${name}' for package ${pkgName} at ${pkgDir}`);
|
|
4255
|
+
}
|
|
4173
4256
|
}
|
|
4174
4257
|
|
|
4175
4258
|
}
|
|
@@ -4211,11 +4294,16 @@ const {
|
|
|
4211
4294
|
runNpmScript
|
|
4212
4295
|
} = __webpack_require__("./lib/util/run-npm-script.js");
|
|
4213
4296
|
|
|
4297
|
+
const {
|
|
4298
|
+
AggregateError
|
|
4299
|
+
} = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
|
|
4300
|
+
|
|
4214
4301
|
class LocalPkgBuilder {
|
|
4215
4302
|
constructor(options) {
|
|
4216
4303
|
this._options = options;
|
|
4217
4304
|
this._fyn = options.fyn;
|
|
4218
4305
|
this._waitItems = {};
|
|
4306
|
+
this._failedItems = {};
|
|
4219
4307
|
}
|
|
4220
4308
|
|
|
4221
4309
|
async start() {
|
|
@@ -4238,11 +4326,17 @@ class LocalPkgBuilder {
|
|
|
4238
4326
|
} = this._options;
|
|
4239
4327
|
|
|
4240
4328
|
this._promiseQ.on("doneItem", data => {
|
|
4241
|
-
this._waitItems[data.item.fullPath].resolve();
|
|
4329
|
+
this._waitItems[data.item.fullPath].resolve({});
|
|
4242
4330
|
});
|
|
4243
4331
|
|
|
4244
4332
|
this._promiseQ.on("failItem", data => {
|
|
4245
|
-
|
|
4333
|
+
const itemRes = {
|
|
4334
|
+
error: new AggregateError([data.error], `failed build local package at ${data.item.fullPath}`)
|
|
4335
|
+
};
|
|
4336
|
+
|
|
4337
|
+
this._waitItems[data.item.fullPath].resolve(itemRes);
|
|
4338
|
+
|
|
4339
|
+
this._failedItems[data.item.fullPath] = itemRes;
|
|
4246
4340
|
});
|
|
4247
4341
|
|
|
4248
4342
|
this._defer = xaa.makeDefer();
|
|
@@ -4254,7 +4348,7 @@ class LocalPkgBuilder {
|
|
|
4254
4348
|
});
|
|
4255
4349
|
|
|
4256
4350
|
this._promiseQ.on("fail", data => {
|
|
4257
|
-
this._defer.reject(data.error);
|
|
4351
|
+
this._defer.reject(new AggregateError([data.error], `failed to build local packages`));
|
|
4258
4352
|
}); //
|
|
4259
4353
|
// localsByDepth is array of array: level 1 depths, level 2 packages
|
|
4260
4354
|
//
|
|
@@ -4340,6 +4434,10 @@ class LocalPkgBuilder {
|
|
|
4340
4434
|
}
|
|
4341
4435
|
|
|
4342
4436
|
async processItem(item) {
|
|
4437
|
+
if (!_.isEmpty(this._failedItems)) {
|
|
4438
|
+
return {};
|
|
4439
|
+
}
|
|
4440
|
+
|
|
4343
4441
|
const dispPath = Path.relative(this._options.fyn._cwd, item.fullPath);
|
|
4344
4442
|
const command = [process.argv[0], this._fynJs, this._fyn._options.registry && `--reg=${this._fyn._options.registry}`, "-q=d --pg=simple --no-build-local", !this._fyn._options.sourceMaps && "--no-source-maps"].filter(x => x).join(" ");
|
|
4345
4443
|
const displayTitle = `building local pkg at ${dispPath}`;
|
|
@@ -4467,7 +4565,7 @@ module.exports = new CliLogger();
|
|
|
4467
4565
|
|
|
4468
4566
|
"use strict";
|
|
4469
4567
|
|
|
4470
|
-
/* eslint-disable no-magic-numbers, max-statements */
|
|
4568
|
+
/* eslint-disable no-magic-numbers, max-statements, no-param-reassign */
|
|
4471
4569
|
|
|
4472
4570
|
const MAX_PENDING_SHOW = 10;
|
|
4473
4571
|
|
|
@@ -4539,7 +4637,7 @@ module.exports = {
|
|
|
4539
4637
|
|
|
4540
4638
|
"use strict";
|
|
4541
4639
|
|
|
4542
|
-
/* eslint-disable global-require, max-statements */
|
|
4640
|
+
/* eslint-disable global-require, max-statements, no-param-reassign */
|
|
4543
4641
|
|
|
4544
4642
|
const Fs = __webpack_require__("./lib/util/file-ops.js");
|
|
4545
4643
|
|
|
@@ -5188,7 +5286,7 @@ module.exports = PkgDepLinker;
|
|
|
5188
5286
|
|
|
5189
5287
|
"use strict";
|
|
5190
5288
|
|
|
5191
|
-
/* eslint-disable no-magic-numbers */
|
|
5289
|
+
/* eslint-disable no-magic-numbers, no-param-reassign */
|
|
5192
5290
|
|
|
5193
5291
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5194
5292
|
|
|
@@ -5736,7 +5834,7 @@ module.exports = PkgDepLocker;
|
|
|
5736
5834
|
|
|
5737
5835
|
"use strict";
|
|
5738
5836
|
|
|
5739
|
-
/* eslint-disable no-magic-numbers, max-params, max-statements, complexity */
|
|
5837
|
+
/* eslint-disable no-magic-numbers, max-params, max-statements, complexity, no-param-reassign */
|
|
5740
5838
|
|
|
5741
5839
|
const _ = __webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js");
|
|
5742
5840
|
|
|
@@ -6254,7 +6352,7 @@ class PkgDepResolver {
|
|
|
6254
6352
|
}
|
|
6255
6353
|
|
|
6256
6354
|
for (const name in deps) {
|
|
6257
|
-
if (this._fyn.checkNoFynLocal(name) || !fynpo.graph.getPackageByName(name)) {
|
|
6355
|
+
if (this._fyn.checkNoFynLocal(name) || !fynpo.graph.getPackageByName(name) || semverUtil.checkUrl(deps[name])) {
|
|
6258
6356
|
continue;
|
|
6259
6357
|
} //
|
|
6260
6358
|
// Check if there is a fynpo package that match 'name@semver'?
|
|
@@ -7592,13 +7690,17 @@ const {
|
|
|
7592
7690
|
|
|
7593
7691
|
const xaa = __webpack_require__("./lib/util/xaa.js");
|
|
7594
7692
|
|
|
7693
|
+
const {
|
|
7694
|
+
AggregateError
|
|
7695
|
+
} = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
|
|
7696
|
+
|
|
7595
7697
|
const {
|
|
7596
7698
|
RESOLVE_ORDER,
|
|
7597
7699
|
RSEMVERS,
|
|
7598
7700
|
LOCK_RSEMVERS,
|
|
7599
7701
|
SEMVER
|
|
7600
7702
|
} = __webpack_require__("./lib/symbols.js");
|
|
7601
|
-
/* eslint-disable max-statements,no-magic-numbers,no-empty,complexity,prefer-template,max-len, max-depth */
|
|
7703
|
+
/* eslint-disable max-statements,no-magic-numbers,no-empty,complexity,prefer-template,max-len, max-depth, no-param-reassign */
|
|
7602
7704
|
|
|
7603
7705
|
|
|
7604
7706
|
class PkgInstaller {
|
|
@@ -7608,6 +7710,7 @@ class PkgInstaller {
|
|
|
7608
7710
|
this._depLinker = new PkgDepLinker({
|
|
7609
7711
|
fyn: this._fyn
|
|
7610
7712
|
});
|
|
7713
|
+
this._localLinks = {};
|
|
7611
7714
|
}
|
|
7612
7715
|
|
|
7613
7716
|
async install() {
|
|
@@ -7646,6 +7749,8 @@ class PkgInstaller {
|
|
|
7646
7749
|
this.preInstall = undefined;
|
|
7647
7750
|
this.postInstall = undefined;
|
|
7648
7751
|
this.toLink = undefined;
|
|
7752
|
+
|
|
7753
|
+
this._fyn.setLocalPkgLinks(this._localLinks);
|
|
7649
7754
|
});
|
|
7650
7755
|
}
|
|
7651
7756
|
|
|
@@ -7660,8 +7765,15 @@ class PkgInstaller {
|
|
|
7660
7765
|
const vdir = this._fyn.getInstalledPkgDir(depInfo.name, depInfo.version, depInfo);
|
|
7661
7766
|
|
|
7662
7767
|
if (depInfo.local === "hard") {
|
|
7768
|
+
const {
|
|
7769
|
+
sourceMaps
|
|
7770
|
+
} = this._fyn._options;
|
|
7771
|
+
this._localLinks[Path.relative(this._fyn._cwd, vdir)] = {
|
|
7772
|
+
srcDir: Path.relative(this._fyn._cwd, depInfo.dir),
|
|
7773
|
+
sourceMaps
|
|
7774
|
+
};
|
|
7663
7775
|
await hardLinkDir.link(depInfo.dir, vdir, {
|
|
7664
|
-
sourceMaps
|
|
7776
|
+
sourceMaps
|
|
7665
7777
|
});
|
|
7666
7778
|
} else {
|
|
7667
7779
|
// await this._depLinker.symlinkLocalPackage(vdir, depInfo.dir);
|
|
@@ -7968,7 +8080,11 @@ class PkgInstaller {
|
|
|
7968
8080
|
|
|
7969
8081
|
async _buildLocalPkg(depInfo) {
|
|
7970
8082
|
if (this._fyn._options.buildLocal && this._fyn._localPkgBuilder) {
|
|
7971
|
-
await this._fyn._localPkgBuilder.waitForItem(depInfo.dir);
|
|
8083
|
+
const itemRes = await this._fyn._localPkgBuilder.waitForItem(depInfo.dir);
|
|
8084
|
+
|
|
8085
|
+
if (itemRes && itemRes.error) {
|
|
8086
|
+
throw new AggregateError([itemRes.error], `install fail because local package build failed`);
|
|
8087
|
+
}
|
|
7972
8088
|
}
|
|
7973
8089
|
}
|
|
7974
8090
|
|
|
@@ -8268,7 +8384,7 @@ module.exports = PkgInstaller;
|
|
|
8268
8384
|
|
|
8269
8385
|
"use strict";
|
|
8270
8386
|
|
|
8271
|
-
/* eslint-disable max-nested-callbacks */
|
|
8387
|
+
/* eslint-disable max-nested-callbacks, no-param-reassign */
|
|
8272
8388
|
|
|
8273
8389
|
const assert = __webpack_require__("assert");
|
|
8274
8390
|
|
|
@@ -8667,7 +8783,7 @@ module.exports = PkgOptResolver;
|
|
|
8667
8783
|
// - npm registry
|
|
8668
8784
|
//
|
|
8669
8785
|
|
|
8670
|
-
/* eslint-disable no-magic-numbers, prefer-template, max-statements */
|
|
8786
|
+
/* eslint-disable no-magic-numbers, prefer-template, max-statements, no-param-reassign */
|
|
8671
8787
|
|
|
8672
8788
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8673
8789
|
|
|
@@ -9513,7 +9629,7 @@ module.exports = {
|
|
|
9513
9629
|
|
|
9514
9630
|
"use strict";
|
|
9515
9631
|
|
|
9516
|
-
/* eslint-disable max-params */
|
|
9632
|
+
/* eslint-disable max-params, no-param-reassign */
|
|
9517
9633
|
|
|
9518
9634
|
const _ = __webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js");
|
|
9519
9635
|
|
|
@@ -10217,11 +10333,18 @@ async function generatePackTree(path, _logger = logger) {
|
|
|
10217
10333
|
if (files.length > 1000) {
|
|
10218
10334
|
_logger.warn(`Local linking package at ${path} has more than ${files.length} files.
|
|
10219
10335
|
>>> This is unusual, please check package .npmignore or 'files' in package.json <<<`);
|
|
10220
|
-
}
|
|
10336
|
+
} // since we are using objects to store directory tree we have to
|
|
10337
|
+
// create objects without the normal prototypes to avoid name conflict
|
|
10338
|
+
// with file names
|
|
10221
10339
|
|
|
10222
|
-
|
|
10223
|
-
|
|
10340
|
+
|
|
10341
|
+
const newDirObj = () => {
|
|
10342
|
+
const n = Object.create(null);
|
|
10343
|
+
n[SYM_FILES] = [];
|
|
10344
|
+
return n;
|
|
10224
10345
|
};
|
|
10346
|
+
|
|
10347
|
+
const fmap = newDirObj();
|
|
10225
10348
|
files.sort().forEach(filePath => {
|
|
10226
10349
|
const dir = Path.dirname(filePath);
|
|
10227
10350
|
|
|
@@ -10234,9 +10357,7 @@ async function generatePackTree(path, _logger = logger) {
|
|
|
10234
10357
|
|
|
10235
10358
|
dir.split("/").forEach(d => {
|
|
10236
10359
|
if (!dmap[d]) {
|
|
10237
|
-
dmap[d] =
|
|
10238
|
-
[SYM_FILES]: []
|
|
10239
|
-
};
|
|
10360
|
+
dmap[d] = newDirObj();
|
|
10240
10361
|
}
|
|
10241
10362
|
|
|
10242
10363
|
dmap = dmap[d];
|
|
@@ -10515,7 +10636,7 @@ module.exports = __webpack_require__("./node_modules/.f/_/item-queue/1.1.2/item-
|
|
|
10515
10636
|
|
|
10516
10637
|
"use strict";
|
|
10517
10638
|
|
|
10518
|
-
/* eslint-disable no-magic-numbers */
|
|
10639
|
+
/* eslint-disable no-magic-numbers, no-param-reassign */
|
|
10519
10640
|
|
|
10520
10641
|
const chalk = __webpack_require__("./node_modules/.f/_/chalk/4.1.2/chalk/source/index.js");
|
|
10521
10642
|
|
|
@@ -10627,6 +10748,7 @@ module.exports = ItemQueue;
|
|
|
10627
10748
|
|
|
10628
10749
|
"use strict";
|
|
10629
10750
|
|
|
10751
|
+
/* eslint-disable no-param-reassign */
|
|
10630
10752
|
|
|
10631
10753
|
const Promise = __webpack_require__("./node_modules/.f/_/bluebird/3.7.2/bluebird/js/release/bluebird.js");
|
|
10632
10754
|
|
|
@@ -10855,7 +10977,7 @@ function localSplit(v) {
|
|
|
10855
10977
|
|
|
10856
10978
|
|
|
10857
10979
|
function getAsFilepath(semver) {
|
|
10858
|
-
if (semver.startsWith("file:")) {
|
|
10980
|
+
if (semver.startsWith("file:") || semver.startsWith("link:")) {
|
|
10859
10981
|
return semver.substr(5);
|
|
10860
10982
|
}
|
|
10861
10983
|
|
|
@@ -10975,7 +11097,7 @@ function analyze(semver) {
|
|
|
10975
11097
|
} else if (urlType === "sym1") {
|
|
10976
11098
|
sv.path = semver.substr(5);
|
|
10977
11099
|
sv.localType = "sym1";
|
|
10978
|
-
} else if (urlType === "file") {
|
|
11100
|
+
} else if (urlType === "file" || urlType === "link") {
|
|
10979
11101
|
setHardLocal(semver.substr(5));
|
|
10980
11102
|
} else {
|
|
10981
11103
|
sv.urlType = urlType;
|
|
@@ -11903,12 +12025,12 @@ class FynpoDepGraph {
|
|
|
11903
12025
|
this._options = _objectSpread({
|
|
11904
12026
|
cwd: process.cwd()
|
|
11905
12027
|
}, options);
|
|
11906
|
-
this.depMapByPath =
|
|
11907
|
-
this.resolvedCache =
|
|
12028
|
+
this.depMapByPath = Object.create(null);
|
|
12029
|
+
this.resolvedCache = Object.create(null);
|
|
11908
12030
|
this.packages = {
|
|
11909
|
-
byId:
|
|
11910
|
-
byName:
|
|
11911
|
-
byPath:
|
|
12031
|
+
byId: Object.create(null),
|
|
12032
|
+
byName: Object.create(null),
|
|
12033
|
+
byPath: Object.create(null)
|
|
11912
12034
|
};
|
|
11913
12035
|
}
|
|
11914
12036
|
/**
|
|
@@ -11921,10 +12043,13 @@ class FynpoDepGraph {
|
|
|
11921
12043
|
await this.readPackages();
|
|
11922
12044
|
}
|
|
11923
12045
|
|
|
11924
|
-
this.
|
|
12046
|
+
this.resolveDirectDeps(); // we don't need indirect deps
|
|
12047
|
+
// topo sort works with only direct deps
|
|
12048
|
+
// this.resolveIndirectDeps();
|
|
11925
12049
|
}
|
|
11926
12050
|
/**
|
|
11927
12051
|
* update package depdencies map
|
|
12052
|
+
*
|
|
11928
12053
|
* - re-entrant safe
|
|
11929
12054
|
*/
|
|
11930
12055
|
|
|
@@ -11942,7 +12067,9 @@ class FynpoDepGraph {
|
|
|
11942
12067
|
|
|
11943
12068
|
getTopoSortPackagePaths() {
|
|
11944
12069
|
const depRecords = {};
|
|
11945
|
-
const changed = [];
|
|
12070
|
+
const changed = []; //
|
|
12071
|
+
// first start with packages that has zero local dependencies
|
|
12072
|
+
//
|
|
11946
12073
|
|
|
11947
12074
|
for (const path in this.depMapByPath) {
|
|
11948
12075
|
const depData = this.depMapByPath[path];
|
|
@@ -11960,12 +12087,14 @@ class FynpoDepGraph {
|
|
|
11960
12087
|
const sorted = [];
|
|
11961
12088
|
|
|
11962
12089
|
while (changed.length > 0) {
|
|
12090
|
+
// remove the zero local dependencies packages from queue
|
|
11963
12091
|
const record = depRecords[changed.pop()];
|
|
11964
12092
|
/* istanbul ignore else */
|
|
11965
12093
|
|
|
11966
12094
|
if (record.count === 0) {
|
|
12095
|
+
// add package to result
|
|
11967
12096
|
record.count = -1;
|
|
11968
|
-
sorted.push(record.depData.pkgInfo.path);
|
|
12097
|
+
sorted.push(record.depData.pkgInfo.path); // subtract depdendencies count for all packages depending on the removed package
|
|
11969
12098
|
|
|
11970
12099
|
for (const path in record.depData.dependentsByPath) {
|
|
11971
12100
|
const record2 = depRecords[path];
|
|
@@ -12144,7 +12273,7 @@ class FynpoDepGraph {
|
|
|
12144
12273
|
byName
|
|
12145
12274
|
} = this.packages;
|
|
12146
12275
|
|
|
12147
|
-
if (byName
|
|
12276
|
+
if (byName[pkgJson.name]) {
|
|
12148
12277
|
byName[pkgJson.name].push(pkgInfo);
|
|
12149
12278
|
} else {
|
|
12150
12279
|
byName[pkgJson.name] = [pkgInfo];
|
|
@@ -12238,8 +12367,8 @@ class FynpoDepGraph {
|
|
|
12238
12367
|
if (!depMapByPath[path]) {
|
|
12239
12368
|
depMapByPath[path] = {
|
|
12240
12369
|
pkgInfo: byPath[path],
|
|
12241
|
-
localDepsByPath:
|
|
12242
|
-
dependentsByPath:
|
|
12370
|
+
localDepsByPath: Object.create(null),
|
|
12371
|
+
dependentsByPath: Object.create(null)
|
|
12243
12372
|
};
|
|
12244
12373
|
}
|
|
12245
12374
|
}
|
|
@@ -12301,7 +12430,7 @@ class FynpoDepGraph {
|
|
|
12301
12430
|
const dataPkg = this.depMapByPath[pkgInfo.path];
|
|
12302
12431
|
const dataDep = this.depMapByPath[depPkg.path]; // check circular
|
|
12303
12432
|
|
|
12304
|
-
if (dataDep.localDepsByPath
|
|
12433
|
+
if (dataDep.localDepsByPath[pkgInfo.path]) {
|
|
12305
12434
|
// remember circular package's path
|
|
12306
12435
|
if (!dataPkg.pathOfCirculars) {
|
|
12307
12436
|
dataPkg.pathOfCirculars = [];
|
|
@@ -12394,6 +12523,7 @@ class FynpoDepGraph {
|
|
|
12394
12523
|
/**
|
|
12395
12524
|
* Figure out all the packages' indirect dependencies on other local packages
|
|
12396
12525
|
*
|
|
12526
|
+
* TODO: very inefficient. optimize this.
|
|
12397
12527
|
*/
|
|
12398
12528
|
|
|
12399
12529
|
|
|
@@ -12425,7 +12555,7 @@ class FynpoDepGraph {
|
|
|
12425
12555
|
} // check if pkg is already part of localDeps
|
|
12426
12556
|
|
|
12427
12557
|
|
|
12428
|
-
if (!dataPkg.localDepsByPath
|
|
12558
|
+
if (!dataPkg.localDepsByPath[depInfo.path]) {
|
|
12429
12559
|
change++;
|
|
12430
12560
|
this.addDep(pkgInfo, depInfo, sec, stepsCopy);
|
|
12431
12561
|
} // resolve further with deps of depPkg
|