@hanseltime/esm-interop-tools 1.0.2 → 1.0.3

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.
@@ -29,6 +29,26 @@ function _path() {
29
29
  };
30
30
  return data;
31
31
  }
32
+ function _systeminformation() {
33
+ const data = require("systeminformation");
34
+ _systeminformation = function() {
35
+ return data;
36
+ };
37
+ return data;
38
+ }
39
+ function _define_property(obj, key, value) {
40
+ if (key in obj) {
41
+ Object.defineProperty(obj, key, {
42
+ value: value,
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true
46
+ });
47
+ } else {
48
+ obj[key] = value;
49
+ }
50
+ return obj;
51
+ }
32
52
  function _interop_require_default(obj) {
33
53
  return obj && obj.__esModule ? obj : {
34
54
  default: obj
@@ -46,8 +66,47 @@ function resolvePkgPath(pkgDir, pkgName, options) {
46
66
  }
47
67
  return path;
48
68
  }
69
+ let FileReadBatcher = class FileReadBatcher {
70
+ async read(file) {
71
+ do {
72
+ if (this.semaphore) {
73
+ await this.semaphore;
74
+ }
75
+ }while (this.batch.length > this.max)
76
+ const read = (0, _promises().readFile)(file);
77
+ this.batch.push(read.then(()=>{
78
+ return undefined;
79
+ }));
80
+ if (this.batch.length === this.max) {
81
+ this.semaphore = (async ()=>{
82
+ await Promise.all(this.batch);
83
+ this.semaphore = undefined;
84
+ this.batch.length = 0;
85
+ })();
86
+ }
87
+ return await read;
88
+ }
89
+ constructor(max){
90
+ _define_property(this, "batch", []);
91
+ _define_property(this, "semaphore", void 0);
92
+ _define_property(this, "max", void 0);
93
+ this.max = max;
94
+ }
95
+ };
49
96
  async function getESMPackages(pkgGraph) {
50
97
  const packagePathsMap = {};
98
+ // Types are wrong
99
+ const openInfo = await (0, _systeminformation().fsOpenFiles)();
100
+ let available;
101
+ if (!openInfo || openInfo.available == null) {
102
+ available = 400;
103
+ } else {
104
+ available = openInfo.available > 400 ? 400 : openInfo.available;
105
+ }
106
+ if (available === 0) {
107
+ throw new Error("There are 0 available file handles to open so getESMPackages cannot read package.json's");
108
+ }
109
+ const fileReadBatcher = new FileReadBatcher(available);
51
110
  // We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them
52
111
  async function resolvePackageJsons(currentNode, previousOptions) {
53
112
  // Look up the package.json
@@ -75,7 +134,7 @@ async function getESMPackages(pkgGraph) {
75
134
  pkgInfos = [];
76
135
  packagePathsMap[currentNode.value.name] = pkgInfos;
77
136
  }
78
- const contents = await (0, _promises().readFile)(jsonPath);
137
+ const contents = await fileReadBatcher.read(jsonPath);
79
138
  const json = JSON.parse(contents.toString());
80
139
  pkgInfos.push({
81
140
  packageJsonPath: jsonPath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await readFile(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["getESMPackages","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","resolvePackagePath","join","Error","pkgGraph","packagePathsMap","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","readFile","json","JSON","parse","toString","push","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;+BA6DsBA;;;eAAAA;;;;yBA7DG;;;;;;;gEACM;;;;;;;yBAOV;;;;;;;;;;;AAErB,SAASC,eACRC,MAAc,EACdC,OAAe,EACfC,OAOC;IAED,MAAM,EAAEC,sBAAsB,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IACpD,MAAMI,OAAOC,IAAAA,6BAAkB,EAACN,SAASD;IACzC,IAAI,CAACM,QAAQ,CAACH,wBAAwB,CAACF,QAAQ,IAAI,CAACG,SAAS;QAC5D,IAAIC,QAAQ;YACX,8DAA8D;YAC9D,OAAOG,IAAAA,YAAI,EAACR,QAAQ;QACrB;QACA,MAAM,IAAIS,MACT,CAAC,4CAA4C,EAAER,QAAQ,mBAAmB,EAAED,QAAQ;IAEtF;IACA,OAAOM;AACR;AA2BO,eA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Q,KAAKI,GAAG,CAACH;YACV;QACD;QACA,OAAOD;IACR,GAAG,IAAIK;AAET"}
1
+ {"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\nimport { fsOpenFiles } from \"systeminformation\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\nclass FileReadBatcher {\n\tprivate batch: Promise<void>[] = [];\n\tprivate semaphore: Promise<void> | undefined;\n\treadonly max: number;\n\tconstructor(max: number) {\n\t\tthis.max = max;\n\t}\n\n\tasync read(file: string): Promise<Buffer> {\n\t\tdo {\n\t\t\tif (this.semaphore) {\n\t\t\t\tawait this.semaphore;\n\t\t\t}\n\t\t} while (this.batch.length > this.max);\n\n\t\tconst read = readFile(file);\n\t\tthis.batch.push(\n\t\t\tread.then(() => {\n\t\t\t\treturn undefined;\n\t\t\t}),\n\t\t);\n\t\tif (this.batch.length === this.max) {\n\t\t\tthis.semaphore = (async () => {\n\t\t\t\tawait Promise.all(this.batch);\n\t\t\t\tthis.semaphore = undefined;\n\t\t\t\tthis.batch.length = 0;\n\t\t\t})();\n\t\t}\n\n\t\treturn await read;\n\t}\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// Types are wrong\n\tconst openInfo = (await fsOpenFiles()) as unknown as {\n\t\tavailable: number;\n\t} | null;\n\tlet available: number;\n\tif (!openInfo || openInfo.available == null) {\n\t\tavailable = 400;\n\t} else {\n\t\tavailable = openInfo.available > 400 ? 400 : openInfo.available;\n\t}\n\tif (available === 0) {\n\t\tthrow new Error(\n\t\t\t\"There are 0 available file handles to open so getESMPackages cannot read package.json's\",\n\t\t);\n\t}\n\tconst fileReadBatcher = new FileReadBatcher(available);\n\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await fileReadBatcher.read(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["getESMPackages","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","resolvePackagePath","join","Error","FileReadBatcher","read","file","semaphore","batch","length","max","readFile","push","then","undefined","Promise","all","constructor","pkgGraph","packagePathsMap","openInfo","fsOpenFiles","available","fileReadBatcher","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","json","JSON","parse","toString","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;+BA+FsBA;;;eAAAA;;;;yBA/FG;;;;;;;gEACM;;;;;;;yBAOV;;;;;;;yBACO;;;;;;;;;;;;;;;;;;;;;;;;AAE5B,SAASC,eACRC,MAAc,EACdC,OAAe,EACfC,OAOC;IAED,MAAM,EAAEC,sBAAsB,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IACpD,MAAMI,OAAOC,IAAAA,6BAAkB,EAACN,SAASD;IACzC,IAAI,CAACM,QAAQ,CAACH,wBAAwB,CAACF,QAAQ,IAAI,CAACG,SAAS;QAC5D,IAAIC,QAAQ;YACX,8DAA8D;YAC9D,OAAOG,IAAAA,YAAI,EAACR,QAAQ;QACrB;QACA,MAAM,IAAIS,MACT,CAAC,4CAA4C,EAAER,QAAQ,mBAAmB,EAAED,QAAQ;IAEtF;IACA,OAAOM;AACR;AAsBA,IAAA,AAAMI,kBAAN,MAAMA;IAQL,MAAMC,KAAKC,IAAY,EAAmB;QACzC,GAAG;YACF,IAAI,IAAI,CAACC,SAAS,EAAE;gBACnB,MAAM,IAAI,CAACA,SAAS;YACrB;QACD,QAAS,IAAI,CAACC,KAAK,CAACC,MAAM,GAAG,IAAI,CAACC,GAAG,CAAE;QAEvC,MAAML,OAAOM,IAAAA,oBAAQ,EAACL;QACtB,IAAI,CAACE,KAAK,CAACI,IAAI,CACdP,KAAKQ,IAAI,CAAC;YACT,OAAOC;QACR;QAED,IAAI,IAAI,CAACN,KAAK,CAACC,MAAM,KAAK,IAAI,CAACC,GAAG,EAAE;YACnC,IAAI,CAACH,SAAS,GAAG,AAAC,CAAA;gBACjB,MAAMQ,QAAQC,GAAG,CAAC,IAAI,CAACR,KAAK;gBAC5B,IAAI,CAACD,SAAS,GAAGO;gBACjB,IAAI,CAACN,KAAK,CAACC,MAAM,GAAG;YACrB,CAAA;QACD;QAEA,OAAO,MAAMJ;IACd;IA1BAY,Y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AAMU,OAAOC,KAAKC,KAAK,CAACH,SAASI,QAAQ;QACzCR,SAASpB,IAAI,CAAC;YACbuB,iBAAiBR;YACjBc,UAAUJ,KAAKK,IAAI,KAAK;QACzB;QACA,OAAO;YACN;gBACCX,sBAAsBM,KAAKN,oBAAoB;gBAC/CH,eAAeD;YAChB;YACA;SACA;IACF;IAEA,oFAAoF;IACpF,MAAMT,SAASyB,iBAAiB,CAACnB;IAEjC,OAAOoB,MAAMC,IAAI,CAChBC,OAAOC,IAAI,CAAC5B,iBAAiB6B,MAAM,CAAC,CAACC,MAAMC;QAC1C,MAAMC,QAAQhC,eAAe,CAAC+B,EAAE;QAChCC,MAAMC,OAAO,CAAC,CAAClB;YACd,IAAIA,KAAKO,QAAQ,EAAE;gBAClBQ,KAAKI,GAAG,CAACH;YACV;QACD;QACA,OAAOD;IACR,GAAG,IAAIK;AAET"}
@@ -27,9 +27,23 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
30
43
  import { readFile } from "node:fs/promises";
31
44
  import resolvePackagePath from "resolve-package-path";
32
45
  import { join } from "path";
46
+ import { fsOpenFiles } from "systeminformation";
33
47
  function resolvePkgPath(pkgDir, pkgName, options) {
34
48
  const { optionalDepsFromParent, isPatch, isRoot } = options;
35
49
  const path = resolvePackagePath(pkgName, pkgDir);
@@ -42,6 +56,36 @@ function resolvePkgPath(pkgDir, pkgName, options) {
42
56
  }
43
57
  return path;
44
58
  }
59
+ let FileReadBatcher = class FileReadBatcher {
60
+ read(file) {
61
+ var _this = this;
62
+ return _async_to_generator(function*() {
63
+ do {
64
+ if (_this.semaphore) {
65
+ yield _this.semaphore;
66
+ }
67
+ }while (_this.batch.length > _this.max)
68
+ const read = readFile(file);
69
+ _this.batch.push(read.then(()=>{
70
+ return undefined;
71
+ }));
72
+ if (_this.batch.length === _this.max) {
73
+ _this.semaphore = _async_to_generator(function*() {
74
+ yield Promise.all(_this.batch);
75
+ _this.semaphore = undefined;
76
+ _this.batch.length = 0;
77
+ })();
78
+ }
79
+ return yield read;
80
+ })();
81
+ }
82
+ constructor(max){
83
+ _define_property(this, "batch", []);
84
+ _define_property(this, "semaphore", void 0);
85
+ _define_property(this, "max", void 0);
86
+ this.max = max;
87
+ }
88
+ };
45
89
  /**
46
90
  * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)
47
91
  * @param pkgGraph
@@ -52,6 +96,18 @@ function resolvePkgPath(pkgDir, pkgName, options) {
52
96
  function _getESMPackages() {
53
97
  _getESMPackages = _async_to_generator(function*(pkgGraph) {
54
98
  const packagePathsMap = {};
99
+ // Types are wrong
100
+ const openInfo = yield fsOpenFiles();
101
+ let available;
102
+ if (!openInfo || openInfo.available == null) {
103
+ available = 400;
104
+ } else {
105
+ available = openInfo.available > 400 ? 400 : openInfo.available;
106
+ }
107
+ if (available === 0) {
108
+ throw new Error("There are 0 available file handles to open so getESMPackages cannot read package.json's");
109
+ }
110
+ const fileReadBatcher = new FileReadBatcher(available);
55
111
  function resolvePackageJsons(currentNode, previousOptions) {
56
112
  return _resolvePackageJsons.apply(this, arguments);
57
113
  }
@@ -84,7 +140,7 @@ function _getESMPackages() {
84
140
  pkgInfos = [];
85
141
  packagePathsMap[currentNode.value.name] = pkgInfos;
86
142
  }
87
- const contents = yield readFile(jsonPath);
143
+ const contents = yield fileReadBatcher.read(jsonPath);
88
144
  const json = JSON.parse(contents.toString());
89
145
  pkgInfos.push({
90
146
  packageJsonPath: jsonPath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await readFile(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["readFile","resolvePackagePath","join","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","Error","getESMPackages","pkgGraph","packagePathsMap","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","json","JSON","parse","toString","push","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,mBAAc;AACvC,OAAOC,wBAAwB,uBAAuB;AAOtD,SAASC,IAAI,QAAQ,OAAO;AAE5B,SAASC,eACRC,MAAc,EACdC,OAAe,EACfC,OAOC;IAED,MAAM,EAAEC,sBAAsB,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IACpD,MAAMI,OAAOT,mBAAmBI,SAASD;IACzC,IAAI,CAACM,QAAQ,EAACH,mCAAAA,6CAAAA,sBAAwB,CAACF,QAAQ,KAAI,CAACG,SAAS;QAC5D,IAAIC,QAAQ;YACX,8DAA8D;YAC9D,OAAOP,KAAKE,QAAQ;QACrB;QACA,MAAM,IAAIO,MACT,CAAC,4CAA4C,EAAEN,QAAQ,mBAAmB,EAAED,QAAQ;IAEtF;IACA,OAAOM;AACR;AAsBA;;;;CAIC,GACD,gBAAsBE,eAAeC,QAAsB;WAArCD;;SAAAA;IAAAA,kBAAf,oBAAA,UAA8BC,QAAsB;QAC1D,MAAMC,kBAGF,CAAC;iBAEUC,oBACdC,WAA8C,EAC9CC,eAA6B;mBAFfF;;iBAAAA;YAAAA,uBADf,0HAA0H;YAC1H,oBAAA,UACCC,WAA8C,EAC9CC,eAA6B;oBAI5BA;gBAFD,2BAA2B;gBAC3B,MAAMC,WAAWf,eAChBc,CAAAA,iCAAAA,4BAAAA,sCAAAA,gBAAiBE,aAAa,cAA9BF,4CAAAA,iCAAkCJ,SAAST,MAAM,EACjDY,YAAYI,KAAK,CAACC,IAAI,EACtB;oBACCd,sBAAsB,EAAEU,4BAAAA,sCAAAA,gBAAiBK,oBAAoB;oBAC7Dd,SAASQ,YAAYI,KAAK,CAACZ,OAAO;oBAClCC,QAAQO,YAAYI,KAAK,CAACX,MAAM;gBACjC;gBAED,uHAAuH;gBACvH,IAAI,CAACS,UAAU;oBACd,OAAO;wBAAC,CAAC;wBAAG;qBAAK;gBAClB;gBACA,IAAIK,WACHT,eAAe,CAACE,YAAYI,KAAK,CAACC,IAAI,CAAC;gBACxC,IAAIE,UAAU;oBACb,IAAIA,SAASC,IAAI,CAAC,CAACC,OAASA,KAAKC,eAAe,KAAKR,WAAW;wBAC/D,OAAO;4BAAC,CAAC;4BAAG;yBAAM;oBACnB;gBACD,OAAO;oBACNK,WAAW,EAAE;oBACbT,eAAe,CAACE,YAAYI,KAAK,CAACC,IAAI,CAAC,GAAGE;gBAC3C;gBAEA,MAAMI,WAAW,MAAM3B,SAASkB;gBAChC,MAAMU,OAAOC,KAAKC,KAAK,CAACH,SAASI,QAAQ;gBACzCR,SAASS,IAAI,CAAC;oBACbN,iBAAiBR;oBACjBe,UAAUL,KAAKM,IAAI,KAAK;gBACzB;gBACA,OAAO;oBACN;wBACCZ,sBAAsBM,KAAKN,oBAAoB;wBAC/CH,eAAeD;oBAChB;oBACA;iBACA;YACF;mBA1CeH;;QA4Cf,oFAAoF;QACpF,MAAMF,SAASsB,iBAAiB,CAACpB;QAEjC,OAAOqB,MAAMC,IAAI,CAChBC,OAAOC,IAAI,CAACzB,iBAAiB0B,MAAM,CAAC,CAACC,MAAMC;YAC1C,MAAMC,QAAQ7B,eAAe,CAAC4B,EAAE;YAChCC,MAAMC,OAAO,CAAC,CAACnB;gBACd,IAAIA,KAAKQ,QAAQ,EAAE;oBAClBQ,KAAKI,GAAG,CAACH;gBACV;YACD;YACA,OAAOD;QACR,GAAG,IAAIK;IAET;WAhEsBlC"}
1
+ {"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\nimport { fsOpenFiles } from \"systeminformation\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\nclass FileReadBatcher {\n\tprivate batch: Promise<void>[] = [];\n\tprivate semaphore: Promise<void> | undefined;\n\treadonly max: number;\n\tconstructor(max: number) {\n\t\tthis.max = max;\n\t}\n\n\tasync read(file: string): Promise<Buffer> {\n\t\tdo {\n\t\t\tif (this.semaphore) {\n\t\t\t\tawait this.semaphore;\n\t\t\t}\n\t\t} while (this.batch.length > this.max);\n\n\t\tconst read = readFile(file);\n\t\tthis.batch.push(\n\t\t\tread.then(() => {\n\t\t\t\treturn undefined;\n\t\t\t}),\n\t\t);\n\t\tif (this.batch.length === this.max) {\n\t\t\tthis.semaphore = (async () => {\n\t\t\t\tawait Promise.all(this.batch);\n\t\t\t\tthis.semaphore = undefined;\n\t\t\t\tthis.batch.length = 0;\n\t\t\t})();\n\t\t}\n\n\t\treturn await read;\n\t}\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// Types are wrong\n\tconst openInfo = (await fsOpenFiles()) as unknown as {\n\t\tavailable: number;\n\t} | null;\n\tlet available: number;\n\tif (!openInfo || openInfo.available == null) {\n\t\tavailable = 400;\n\t} else {\n\t\tavailable = openInfo.available > 400 ? 400 : openInfo.available;\n\t}\n\tif (available === 0) {\n\t\tthrow new Error(\n\t\t\t\"There are 0 available file handles to open so getESMPackages cannot read package.json's\",\n\t\t);\n\t}\n\tconst fileReadBatcher = new FileReadBatcher(available);\n\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await fileReadBatcher.read(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["readFile","resolvePackagePath","join","fsOpenFiles","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","Error","FileReadBatcher","read","file","semaphore","batch","length","max","push","then","undefined","Promise","all","constructor","getESMPackages","pkgGraph","packagePathsMap","openInfo","available","fileReadBatcher","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","json","JSON","parse","toString","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,mBAAc;AACvC,OAAOC,wBAAwB,uBAAuB;AAOtD,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,WAAW,Q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,MAAMU,OAAOC,KAAKC,KAAK,CAACH,SAASI,QAAQ;gBACzCR,SAASpB,IAAI,CAAC;oBACbuB,iBAAiBR;oBACjBc,UAAUJ,KAAKK,IAAI,KAAK;gBACzB;gBACA,OAAO;oBACN;wBACCX,sBAAsBM,KAAKN,oBAAoB;wBAC/CH,eAAeD;oBAChB;oBACA;iBACA;YACF;mBA1CeH;;QA4Cf,oFAAoF;QACpF,MAAML,SAASwB,iBAAiB,CAACnB;QAEjC,OAAOoB,MAAMC,IAAI,CAChBC,OAAOC,IAAI,CAAC3B,iBAAiB4B,MAAM,CAAC,CAACC,MAAMC;YAC1C,MAAMC,QAAQ/B,eAAe,CAAC8B,EAAE;YAChCC,MAAMC,OAAO,CAAC,CAAClB;gBACd,IAAIA,KAAKO,QAAQ,EAAE;oBAClBQ,KAAKI,GAAG,CAACH;gBACV;YACD;YACA,OAAOD;QACR,GAAG,IAAIK;IAET;WAjFsBpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getESMPackages.d.ts","sourceRoot":"","sources":["../../../src/operations/getESMPackages.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,YAAY,EAIZ,MAAM,kBAAkB,CAAC;AAiD1B;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,YAAY,qBAgE1D"}
1
+ {"version":3,"file":"getESMPackages.d.ts","sourceRoot":"","sources":["../../../src/operations/getESMPackages.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,YAAY,EAIZ,MAAM,kBAAkB,CAAC;AAmF1B;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,YAAY,qBAiF1D"}
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@biomejs/biome": "1.9.4",
32
32
  "@commitlint/config-angular": "^19.6.0",
33
- "@hanseltime/pkgtest": "^1.0.0",
33
+ "@hanseltime/pkgtest": "^1.3.0",
34
34
  "@hanseltime/swc-plugin-node-globals-inject": "^1.0.0",
35
35
  "@rspack/cli": "^1.1.6",
36
36
  "@rspack/core": "^1.1.6",
@@ -39,7 +39,7 @@
39
39
  "@swc/cli": "^0.6.0",
40
40
  "@swc/core": "^1.10.18",
41
41
  "@types/jest": "^29.5.14",
42
- "@types/node": "^18",
42
+ "@types/node": "^20",
43
43
  "commitlint": "^19.6.1",
44
44
  "husky": "^9.1.7",
45
45
  "jest": "^29.7.0",
@@ -54,11 +54,12 @@
54
54
  "dependencies": {
55
55
  "@semantic-release/exec": "^7.0.3",
56
56
  "commander": "^12.1.0",
57
- "resolve-package-path": "^4.0.3"
57
+ "resolve-package-path": "^4.0.3",
58
+ "systeminformation": "^5.25.11"
58
59
  },
59
60
  "publishConfig": {
60
61
  "access": "public"
61
62
  },
62
63
  "packageManager": "yarn@4.5.3",
63
- "version": "1.0.2"
64
+ "version": "1.0.3"
64
65
  }