fyn 3.1.6 → 3.1.7
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.mjs +62 -15
- package/package.json +1 -1
package/dist/fyn.mjs
CHANGED
|
@@ -28835,18 +28835,21 @@ const asPathRef = (ref) => REF_TYPES.some((t) => ref.startsWith(t)) ? ref : `pat
|
|
|
28835
28835
|
const resolveAutoSearch = (val) => {
|
|
28836
28836
|
if (val === false) return {
|
|
28837
28837
|
enable: false,
|
|
28838
|
-
respectGitignore: false
|
|
28838
|
+
respectGitignore: false,
|
|
28839
|
+
stopOnPackageJsonFound: false
|
|
28839
28840
|
};
|
|
28840
28841
|
if (val && typeof val === "object") {
|
|
28841
28842
|
const obj = val;
|
|
28842
28843
|
return {
|
|
28843
28844
|
enable: obj.enable !== false,
|
|
28844
|
-
respectGitignore: obj.respectGitignore === true
|
|
28845
|
+
respectGitignore: obj.respectGitignore === true,
|
|
28846
|
+
stopOnPackageJsonFound: obj.stopOnPackageJsonFound === true
|
|
28845
28847
|
};
|
|
28846
28848
|
}
|
|
28847
28849
|
return {
|
|
28848
28850
|
enable: true,
|
|
28849
|
-
respectGitignore: false
|
|
28851
|
+
respectGitignore: false,
|
|
28852
|
+
stopOnPackageJsonFound: false
|
|
28850
28853
|
};
|
|
28851
28854
|
};
|
|
28852
28855
|
/**
|
|
@@ -28870,7 +28873,8 @@ function resolvePackagesConfig(packages) {
|
|
|
28870
28873
|
return {
|
|
28871
28874
|
autoSearch: {
|
|
28872
28875
|
enable: true,
|
|
28873
|
-
respectGitignore: false
|
|
28876
|
+
respectGitignore: false,
|
|
28877
|
+
stopOnPackageJsonFound: false
|
|
28874
28878
|
},
|
|
28875
28879
|
include: list,
|
|
28876
28880
|
exclude: [],
|
|
@@ -29732,7 +29736,7 @@ var FynpoDepGraph = class {
|
|
|
29732
29736
|
groups = groupMM(mms, {});
|
|
29733
29737
|
}
|
|
29734
29738
|
const foundInAutoSearch = (path) => {
|
|
29735
|
-
if (!autoSearch) return false;
|
|
29739
|
+
if (!autoSearch || !pkgConfig.autoSearch.stopOnPackageJsonFound) return false;
|
|
29736
29740
|
for (const e of autoSearchFound) if (isPathInside$1(path, e)) return true;
|
|
29737
29741
|
return false;
|
|
29738
29742
|
};
|
|
@@ -29761,8 +29765,36 @@ var FynpoDepGraph = class {
|
|
|
29761
29765
|
});
|
|
29762
29766
|
files.push(scanned);
|
|
29763
29767
|
}
|
|
29764
|
-
const
|
|
29765
|
-
|
|
29768
|
+
const filesByDepth = [...[].concat(...files)].sort((a, b) => {
|
|
29769
|
+
const depth = (file) => posixify$2(Path.dirname(file)).split("/").length;
|
|
29770
|
+
return depth(a) - depth(b) || a.localeCompare(b);
|
|
29771
|
+
});
|
|
29772
|
+
const packageRoots = [];
|
|
29773
|
+
const accepted = [];
|
|
29774
|
+
for (const pkgFile of filesByDepth) {
|
|
29775
|
+
const pkgPath = posixify$2(Path.dirname(pkgFile));
|
|
29776
|
+
const nested = autoSearch && packageRoots.some((root) => isPathInside$1(pkgPath, root));
|
|
29777
|
+
const included = isIncluded(pkgPath);
|
|
29778
|
+
if (!included && !nested) continue;
|
|
29779
|
+
const managed = !autoSearch || !nested || includeMms.length > 0 && included;
|
|
29780
|
+
const pkgStr = await promises.readFile(Path.join(cwd, pkgFile), "utf-8");
|
|
29781
|
+
const pkgJson = JSON.parse(pkgStr);
|
|
29782
|
+
if (pkgJson.fynpo === false) continue;
|
|
29783
|
+
if (!pkgJson.name) continue;
|
|
29784
|
+
accepted.push({
|
|
29785
|
+
pkgFile,
|
|
29786
|
+
pkgPath,
|
|
29787
|
+
pkgStr,
|
|
29788
|
+
pkgJson,
|
|
29789
|
+
managed,
|
|
29790
|
+
nested
|
|
29791
|
+
});
|
|
29792
|
+
packageRoots.push(pkgPath);
|
|
29793
|
+
}
|
|
29794
|
+
for (const pkg of accepted.sort((a, b) => a.pkgFile.localeCompare(b.pkgFile))) this.addPackage(pkg.pkgJson, pkg.pkgPath, pkg.pkgStr, {
|
|
29795
|
+
managed: pkg.managed,
|
|
29796
|
+
nested: pkg.nested
|
|
29797
|
+
});
|
|
29766
29798
|
this.updateAuxPackageData();
|
|
29767
29799
|
return this.packages;
|
|
29768
29800
|
}
|
|
@@ -29771,10 +29803,10 @@ var FynpoDepGraph = class {
|
|
|
29771
29803
|
*
|
|
29772
29804
|
* @param pkgFile - path to the package.json file
|
|
29773
29805
|
*/
|
|
29774
|
-
async addPackageByFile(pkgFile) {
|
|
29806
|
+
async addPackageByFile(pkgFile, management = {}) {
|
|
29775
29807
|
const pkgStr = await promises.readFile(Path.join(this._options.cwd, pkgFile), "utf-8");
|
|
29776
29808
|
const pkgJson = JSON.parse(pkgStr);
|
|
29777
|
-
this.addPackage(pkgJson, Path.dirname(pkgFile), pkgStr);
|
|
29809
|
+
return this.addPackage(pkgJson, posixify$2(Path.dirname(pkgFile)), pkgStr, management);
|
|
29778
29810
|
}
|
|
29779
29811
|
/**
|
|
29780
29812
|
* Add a package to the graph using the data from its package.json
|
|
@@ -29784,7 +29816,7 @@ var FynpoDepGraph = class {
|
|
|
29784
29816
|
* @param pkgStr - string form of package.json
|
|
29785
29817
|
* @returns
|
|
29786
29818
|
*/
|
|
29787
|
-
addPackage(pkgJson, pkgPath, pkgStr) {
|
|
29819
|
+
addPackage(pkgJson, pkgPath, pkgStr, management = {}) {
|
|
29788
29820
|
if (pkgJson.fynpo === false) return;
|
|
29789
29821
|
assert(pkgJson.name, `package at ${pkgPath} doesn't have name`);
|
|
29790
29822
|
const pkgDir = pkgJson.name[0] === "@" && (pkgPath.endsWith(`/${pkgJson.name}`) || pkgPath === pkgJson.name) ? pkgJson.name : Path.basename(pkgPath);
|
|
@@ -29805,11 +29837,20 @@ var FynpoDepGraph = class {
|
|
|
29805
29837
|
};
|
|
29806
29838
|
Object.defineProperties(pkgInfo, {
|
|
29807
29839
|
pkgStr: { enumerable: false },
|
|
29808
|
-
pkgJson: { enumerable: false }
|
|
29840
|
+
pkgJson: { enumerable: false },
|
|
29841
|
+
managed: {
|
|
29842
|
+
value: management.managed !== false,
|
|
29843
|
+
enumerable: false
|
|
29844
|
+
},
|
|
29845
|
+
nested: {
|
|
29846
|
+
value: management.nested === true,
|
|
29847
|
+
enumerable: false
|
|
29848
|
+
}
|
|
29809
29849
|
});
|
|
29810
29850
|
const { byName } = this.packages;
|
|
29811
29851
|
if (byName[pkgJson.name]) byName[pkgJson.name].push(pkgInfo);
|
|
29812
29852
|
else byName[pkgJson.name] = [pkgInfo];
|
|
29853
|
+
return pkgInfo;
|
|
29813
29854
|
}
|
|
29814
29855
|
/**
|
|
29815
29856
|
* update auxiliary package data
|
|
@@ -29823,11 +29864,17 @@ var FynpoDepGraph = class {
|
|
|
29823
29864
|
this.packages.byPath = {};
|
|
29824
29865
|
const { byName, byPath, byId } = this.packages;
|
|
29825
29866
|
for (const name in byName) {
|
|
29867
|
+
byName[name].sort((a, b) => {
|
|
29868
|
+
const versionOrder = import_semver.default.compare(b.version, a.version);
|
|
29869
|
+
if (versionOrder !== 0) return versionOrder;
|
|
29870
|
+
if (a.managed !== b.managed) return a.managed === false ? 1 : -1;
|
|
29871
|
+
return a.path.localeCompare(b.path);
|
|
29872
|
+
});
|
|
29826
29873
|
byName[name].forEach((pkg) => {
|
|
29827
29874
|
byPath[pkg.path] = pkg;
|
|
29828
|
-
|
|
29875
|
+
const id = `${pkg.name}@${pkg.version}`;
|
|
29876
|
+
if (!byId[id] || byId[id].managed === false && pkg.managed !== false) byId[id] = pkg;
|
|
29829
29877
|
});
|
|
29830
|
-
if (byName[name].length > 1) byName[name].sort((a, b) => import_semver.default.compare(b.version, a.version));
|
|
29831
29878
|
}
|
|
29832
29879
|
}
|
|
29833
29880
|
/**
|
|
@@ -29894,8 +29941,8 @@ var FynpoDepGraph = class {
|
|
|
29894
29941
|
localDepsByPath: Object.create(null),
|
|
29895
29942
|
dependentsByPath: Object.create(null)
|
|
29896
29943
|
};
|
|
29897
|
-
for (const
|
|
29898
|
-
const pkgInfo =
|
|
29944
|
+
for (const path in byPath) {
|
|
29945
|
+
const pkgInfo = byPath[path];
|
|
29899
29946
|
const depData = depMapByPath[pkgInfo.path];
|
|
29900
29947
|
doResolve(depData, pkgInfo.dependencies, "dep");
|
|
29901
29948
|
doResolve(depData, pkgInfo.devDependencies, "dev");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fyn",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.7",
|
|
5
5
|
"description": "fyn is a node.js package manager, and supports fynpo -- a zero setup monorepo tool",
|
|
6
6
|
"main": "./bin/index.mjs",
|
|
7
7
|
"homepage": "https://github.com/jchip/fynjs/tree/main/packages/fyn",
|