fyn 1.1.24 → 1.1.25

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 +267 -21
  2. package/package.json +4 -4
package/dist/fyn.js CHANGED
@@ -5753,7 +5753,7 @@ const {
5753
5753
  const {
5754
5754
  getDepSection,
5755
5755
  makeDepStep
5756
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/index.js");
5756
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/index.js");
5757
5757
 
5758
5758
  const xaa = __webpack_require__("./lib/util/xaa.js");
5759
5759
 
@@ -8723,7 +8723,7 @@ const {
8723
8723
 
8724
8724
  const {
8725
8725
  PackageRef
8726
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/index.js");
8726
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/index.js");
8727
8727
 
8728
8728
  const WATCH_TIME = 5000; // consider meta cache stale after this much time (30 minutes)
8729
8729
 
@@ -9739,7 +9739,7 @@ const {
9739
9739
  const {
9740
9740
  FynpoConfigManager,
9741
9741
  FynpoDepGraph
9742
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/index.js");
9742
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/index.js");
9743
9743
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
9744
9744
 
9745
9745
 
@@ -11237,7 +11237,248 @@ module.exports = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa
11237
11237
 
11238
11238
  /***/ }),
11239
11239
 
11240
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11240
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/caching.js":
11241
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11242
+
11243
+ "use strict";
11244
+
11245
+
11246
+ Object.defineProperty(exports, "__esModule", ({
11247
+ value: true
11248
+ }));
11249
+ exports.processOutput = exports.processLifecycleInput = exports.processInput = void 0;
11250
+
11251
+ const tslib_1 = __webpack_require__("./node_modules/.f/_/tslib/2.1.0/tslib/tslib.es6.js");
11252
+
11253
+ const filter_scan_dir_1 = __webpack_require__("./node_modules/.f/_/filter-scan-dir/1.5.5/filter-scan-dir/lib/index.js");
11254
+
11255
+ const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
11256
+ const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11257
+ const fs_1 = (0, tslib_1.__importDefault)(__webpack_require__("fs"));
11258
+ const path_1 = (0, tslib_1.__importDefault)(__webpack_require__("path"));
11259
+ const crypto_1 = (0, tslib_1.__importDefault)(__webpack_require__("crypto"));
11260
+ /**
11261
+ * generate sha256 has of a file
11262
+ *
11263
+ * @param filename
11264
+ * @returns
11265
+ */
11266
+
11267
+ async function hashFile(filename, encoding = "base64url") {
11268
+ const data = await fs_1.default.promises.readFile(filename);
11269
+ const hash = crypto_1.default.createHash("sha256").update(data).digest(encoding);
11270
+ return hash;
11271
+ }
11272
+ /**
11273
+ * create a sha256 hash for some data
11274
+ *
11275
+ * @param data
11276
+ * @returns
11277
+ */
11278
+
11279
+
11280
+ function hashData(data, encoding = "base64url") {
11281
+ return crypto_1.default.createHash("sha256").update(data).digest(encoding);
11282
+ }
11283
+ /**
11284
+ * generate hash for an array of files
11285
+ *
11286
+ * @param files
11287
+ * @returns object with each file point to its hash
11288
+ */
11289
+
11290
+
11291
+ async function hashFiles(cwd, files, encoding = "base64url") {
11292
+ const hashes = {};
11293
+ const promises = [];
11294
+
11295
+ for (const file of files) {
11296
+ promises.push(hashFile(path_1.default.join(cwd, file), encoding).then(h => hashes[file] = h));
11297
+ }
11298
+
11299
+ await Promise.all(promises);
11300
+ const result = {};
11301
+
11302
+ for (const file of files) {
11303
+ result[file] = hashes[file];
11304
+ }
11305
+
11306
+ return result;
11307
+ }
11308
+ /**
11309
+ *
11310
+ * @param cwd
11311
+ * @returns
11312
+ */
11313
+
11314
+
11315
+ async function readPackageJson(cwd) {
11316
+ return JSON.parse(await fs_1.default.promises.readFile(path_1.default.join(cwd, "package.json"), "utf-8"));
11317
+ }
11318
+ /**
11319
+ * Convert minimatch string patterns to Minimatch instances
11320
+ *
11321
+ * @param patterns
11322
+ * @returns
11323
+ */
11324
+
11325
+
11326
+ function makeMmPatterns(patterns, options = {
11327
+ dot: true
11328
+ }) {
11329
+ return [].concat(patterns).map(x => x && new minimatch_1.default.Minimatch(x, options)).filter(x => x);
11330
+ }
11331
+ /**
11332
+ *
11333
+ * @param fullPath
11334
+ * @param patterns
11335
+ * @returns
11336
+ */
11337
+
11338
+
11339
+ function checkMmMatch(fullPath, patterns) {
11340
+ return !lodash_1.default.isEmpty(patterns) && patterns.find(patternMm => patternMm.match(fullPath));
11341
+ }
11342
+ /**
11343
+ * Scan for files using include and exclude patterns
11344
+ *
11345
+ * @param cwd
11346
+ * @param input
11347
+ * @returns
11348
+ */
11349
+
11350
+
11351
+ async function scanFiles(cwd, includes, excludes) {
11352
+ const filter = (_file, _path, extras) => {
11353
+ if (!checkMmMatch(extras.dirFile, includes) || checkMmMatch(extras.dirFile, excludes)) {
11354
+ return false;
11355
+ }
11356
+
11357
+ return true;
11358
+ };
11359
+
11360
+ return (await (0, filter_scan_dir_1.filterScanDir)({
11361
+ cwd,
11362
+ filter,
11363
+ filterDir: filter,
11364
+ fullStat: false,
11365
+ concurrency: 500
11366
+ })).sort();
11367
+ }
11368
+
11369
+ async function processInput({
11370
+ cwd,
11371
+ input,
11372
+ packageJson,
11373
+ extra
11374
+ } = {
11375
+ input: {}
11376
+ }) {
11377
+ const files = await scanFiles(cwd, makeMmPatterns(input.include), makeMmPatterns(input.exclude));
11378
+ const fileHashes = await hashFiles(cwd, files);
11379
+ const data = {
11380
+ env: lodash_1.default.pick(process.env, input.includeEnv),
11381
+ versions: lodash_1.default.pick(process.versions, input.includeVersions),
11382
+ npmScripts: lodash_1.default.pick(lodash_1.default.get(packageJson || (await readPackageJson(cwd)), "scripts"), input.npmScripts),
11383
+ fileHashes,
11384
+ extra: extra || "" // additional data
11385
+
11386
+ };
11387
+ const hash = hashData(JSON.stringify(data));
11388
+ return {
11389
+ files,
11390
+ data,
11391
+ hash
11392
+ };
11393
+ }
11394
+
11395
+ exports.processInput = processInput;
11396
+ /**
11397
+ *
11398
+ * @param param0
11399
+ * @returns
11400
+ */
11401
+
11402
+ async function processLifecycleInput({
11403
+ cwd,
11404
+ input,
11405
+ packageJson
11406
+ } = {
11407
+ input: {}
11408
+ }) {
11409
+ packageJson = packageJson || (await readPackageJson(cwd));
11410
+ const npmScripts = lodash_1.default.pick(lodash_1.default.get(packageJson, "scripts"), input.npmScripts);
11411
+
11412
+ if (lodash_1.default.isEmpty(npmScripts)) {
11413
+ return {};
11414
+ }
11415
+
11416
+ return await processInput({
11417
+ cwd,
11418
+ input,
11419
+ packageJson
11420
+ });
11421
+ }
11422
+
11423
+ exports.processLifecycleInput = processLifecycleInput;
11424
+ /**
11425
+ * Process build cache output file config.
11426
+ *
11427
+ * @param param0
11428
+ * @returns
11429
+ */
11430
+
11431
+ async function processOutput({
11432
+ cwd,
11433
+ inputHash,
11434
+ calcHash,
11435
+ output,
11436
+ preFiles
11437
+ } = {
11438
+ output: {}
11439
+ }) {
11440
+ const mmIncludes = makeMmPatterns(output.include);
11441
+ const mmExcludes = makeMmPatterns(output.exclude);
11442
+ const files = await scanFiles(cwd, mmIncludes, mmExcludes);
11443
+ preFiles = [].concat(preFiles).filter(x => {
11444
+ if (!x || checkMmMatch(x, mmExcludes)) {
11445
+ return false;
11446
+ }
11447
+
11448
+ return true;
11449
+ }).map(x => x.replace(`${cwd}${path_1.default.sep}`, ""));
11450
+ let hash = "";
11451
+ let fileHashes = {};
11452
+ const allFiles = lodash_1.default.uniq(files.concat(preFiles)).sort();
11453
+ let data = {
11454
+ inputHash,
11455
+ fileHashes
11456
+ }; //
11457
+
11458
+ if (calcHash) {
11459
+ fileHashes = await hashFiles(cwd, allFiles);
11460
+ data = {
11461
+ inputHash,
11462
+ fileHashes
11463
+ };
11464
+ hash = hashData(JSON.stringify(data));
11465
+ } //
11466
+
11467
+
11468
+ return {
11469
+ files: allFiles,
11470
+ data,
11471
+ hash,
11472
+ access: Date.now(),
11473
+ create: Date.now()
11474
+ };
11475
+ }
11476
+
11477
+ exports.processOutput = processOutput;
11478
+
11479
+ /***/ }),
11480
+
11481
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11241
11482
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11242
11483
 
11243
11484
  "use strict";
@@ -11387,7 +11628,7 @@ exports.FynpoConfigManager = FynpoConfigManager;
11387
11628
 
11388
11629
  /***/ }),
11389
11630
 
11390
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11631
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11391
11632
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11392
11633
 
11393
11634
  "use strict";
@@ -11411,14 +11652,15 @@ const path_1 = (0, tslib_1.__importDefault)(__webpack_require__("path"));
11411
11652
 
11412
11653
  const fs_1 = __webpack_require__("fs");
11413
11654
 
11414
- const filter_scan_dir_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/filter-scan-dir/1.5.5/filter-scan-dir/lib/index.js"));
11655
+ const filter_scan_dir_1 = __webpack_require__("./node_modules/.f/_/filter-scan-dir/1.5.5/filter-scan-dir/lib/index.js");
11656
+
11415
11657
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
11416
11658
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11417
11659
  const semver_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/semver/7.3.5/semver/index.js"));
11418
11660
 
11419
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11661
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11420
11662
 
11421
- const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/util.js");
11663
+ const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/util.js");
11422
11664
 
11423
11665
  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"));
11424
11666
  const DepSectionMap = {
@@ -11733,9 +11975,10 @@ class FynpoDepGraph {
11733
11975
  const files = [];
11734
11976
 
11735
11977
  for (const prefix in groups) {
11736
- const scanned = await (0, filter_scan_dir_1.default)({
11978
+ const scanned = await (0, filter_scan_dir_1.filterScanDir)({
11737
11979
  cwd,
11738
11980
  prefix,
11981
+ concurrency: 500,
11739
11982
  filter: (file, path) => {
11740
11983
  if (path && path !== "." && file === "package.json") {
11741
11984
  if (foundInAutoSearch(path)) {
@@ -11767,7 +12010,7 @@ class FynpoDepGraph {
11767
12010
  files.push(scanned);
11768
12011
  }
11769
12012
 
11770
- const allFiles = [].concat(...files); // Read each package.json and generate PackageInfo for it
12013
+ const allFiles = [].concat(...files).sort(); // Read each package.json and generate PackageInfo for it
11771
12014
 
11772
12015
  for (const pkgFile of allFiles) {
11773
12016
  await this.addPackageByFile(pkgFile);
@@ -12138,7 +12381,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
12138
12381
 
12139
12382
  /***/ }),
12140
12383
 
12141
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/index.js":
12384
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/index.js":
12142
12385
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12143
12386
 
12144
12387
  "use strict";
@@ -12147,7 +12390,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
12147
12390
  Object.defineProperty(exports, "__esModule", ({
12148
12391
  value: true
12149
12392
  }));
12150
- exports.makePkgDeps = exports.readFynpoPackages = void 0;
12393
+ exports.makePkgDeps = exports.readFynpoPackages = exports.caching = void 0;
12151
12394
 
12152
12395
  const tslib_1 = __webpack_require__("./node_modules/.f/_/tslib/2.1.0/tslib/tslib.es6.js");
12153
12396
 
@@ -12155,15 +12398,17 @@ const path_1 = (0, tslib_1.__importDefault)(__webpack_require__("path"));
12155
12398
 
12156
12399
  const fs_1 = __webpack_require__("fs");
12157
12400
 
12158
- const filter_scan_dir_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/filter-scan-dir/1.5.5/filter-scan-dir/lib/index.js"));
12401
+ const filter_scan_dir_1 = __webpack_require__("./node_modules/.f/_/filter-scan-dir/1.5.5/filter-scan-dir/lib/index.js");
12402
+
12159
12403
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
12160
12404
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
12161
12405
 
12162
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12406
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12163
12407
 
12164
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12165
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12166
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12408
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12409
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12410
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12411
+ exports.caching = (0, tslib_1.__importStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/caching.js"));
12167
12412
  /**
12168
12413
  * Take an array of packages and figure out their dependencies on each other
12169
12414
  *
@@ -12279,9 +12524,10 @@ async function readFynpoPackages({
12279
12524
  const files = [];
12280
12525
 
12281
12526
  for (const prefix in groups) {
12282
- files.push(await (0, filter_scan_dir_1.default)({
12527
+ files.push(await (0, filter_scan_dir_1.filterScanDir)({
12283
12528
  cwd,
12284
12529
  prefix,
12530
+ concurrency: 500,
12285
12531
  filter: f => f === "package.json",
12286
12532
  filterDir: (dir, _p, extras) => {
12287
12533
  if (dir !== "node_modules") {
@@ -12293,7 +12539,7 @@ async function readFynpoPackages({
12293
12539
  }));
12294
12540
  }
12295
12541
 
12296
- const allFiles = [].concat(...files);
12542
+ const allFiles = [].concat(...files).sort();
12297
12543
  const allPkgs = {};
12298
12544
 
12299
12545
  for (const pkgFile of allFiles) {
@@ -12418,7 +12664,7 @@ exports.makePkgDeps = makePkgDeps;
12418
12664
 
12419
12665
  /***/ }),
12420
12666
 
12421
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12667
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12422
12668
  /***/ ((__unused_webpack_module, exports) => {
12423
12669
 
12424
12670
  "use strict";
@@ -12464,7 +12710,7 @@ exports.groupMM = groupMM;
12464
12710
 
12465
12711
  /***/ }),
12466
12712
 
12467
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.8-fynlocal_h/@fynpo/base/dist/util.js":
12713
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.9-fynlocal_h/@fynpo/base/dist/util.js":
12468
12714
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12469
12715
 
12470
12716
  "use strict";
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.24",
4
- "description": "A node package manager, fast, workspace, and better productivity and efficiency",
3
+ "version": "1.1.25",
4
+ "description": "The package manager for fynpo, a zero setup monorepo manager",
5
5
  "main": "./bin/fyn.js",
6
- "homepage": "https://www.electrode.io/fynpo/",
6
+ "homepage": "https://jchip.github.io/fynpo/",
7
7
  "license": "Apache-2.0",
8
8
  "scripts": {
9
9
  "test": "xrun xarc/test-only",
@@ -62,7 +62,7 @@
62
62
  ],
63
63
  "repository": {
64
64
  "type": "git",
65
- "url": "https://github.com/electrode-io/fynpo.git",
65
+ "url": "https://github.com/jchip/fynpo.git",
66
66
  "directory": "packages/fyn"
67
67
  },
68
68
  "contributors": [