nf3 0.3.12 → 0.3.13
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/_chunks/trace.mjs +11 -4
- package/package.json +1 -1
package/dist/_chunks/trace.mjs
CHANGED
|
@@ -199,7 +199,10 @@ async function traceNodeModules(input, opts) {
|
|
|
199
199
|
if (opts.chmod) await fsp.chmod(dst, opts.chmod === true ? 420 : opts.chmod);
|
|
200
200
|
}
|
|
201
201
|
const pkgJSON = pkg.versions[version].pkgJSON;
|
|
202
|
-
|
|
202
|
+
if (pkgJSON.exports) {
|
|
203
|
+
pkgJSON.exports = JSON.parse(JSON.stringify(pkgJSON.exports));
|
|
204
|
+
applyProductionCondition(pkgJSON.exports);
|
|
205
|
+
}
|
|
203
206
|
const pkgJSONPath = join(outDir, pkgPath, "package.json");
|
|
204
207
|
await fsp.mkdir(dirname(pkgJSONPath), { recursive: true });
|
|
205
208
|
await fsp.writeFile(pkgJSONPath, JSON.stringify(pkgJSON, null, 2), "utf8");
|
|
@@ -243,8 +246,9 @@ async function traceNodeModules(input, opts) {
|
|
|
243
246
|
}));
|
|
244
247
|
for (const [pkgName, pkgVersions] of Object.entries(multiVersionPkgs)) {
|
|
245
248
|
const versionEntries = Object.entries(pkgVersions).sort(([v1, p1], [v2, p2]) => {
|
|
246
|
-
|
|
247
|
-
|
|
249
|
+
const d1 = p1.length === 0 ? Infinity : p1.length;
|
|
250
|
+
const d2 = p2.length === 0 ? Infinity : p2.length;
|
|
251
|
+
if (d1 !== d2) return d2 - d1;
|
|
248
252
|
return compareVersions(v1, v2);
|
|
249
253
|
});
|
|
250
254
|
for (const [version, parentPkgs] of versionEntries) {
|
|
@@ -275,7 +279,10 @@ function applyProductionCondition(exports) {
|
|
|
275
279
|
if (!exports || typeof exports === "string" || Array.isArray(exports)) return;
|
|
276
280
|
if ("production" in exports) if (typeof exports.production === "string") exports.default = exports.production;
|
|
277
281
|
else Object.assign(exports, exports.production);
|
|
278
|
-
for (const key in exports)
|
|
282
|
+
for (const key in exports) {
|
|
283
|
+
if (key === "production") continue;
|
|
284
|
+
applyProductionCondition(exports[key]);
|
|
285
|
+
}
|
|
279
286
|
}
|
|
280
287
|
function resolveFullTraceEntry(entries, pkgName) {
|
|
281
288
|
if (!entries) return;
|