deslop-js 0.8.3 → 0.9.1
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/index.cjs +28 -31
- package/dist/index.mjs +28 -31
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -7513,7 +7513,7 @@ const traceReachability = (graph) => {
|
|
|
7513
7513
|
//#endregion
|
|
7514
7514
|
//#region src/linker/re-exports.ts
|
|
7515
7515
|
const resolveReExportChains = (graph) => {
|
|
7516
|
-
const
|
|
7516
|
+
const sourceToWildcardTargets = buildSourceWildcardTargetMap(graph);
|
|
7517
7517
|
const maxIterations = graph.modules.length * 2 + 1;
|
|
7518
7518
|
let didChange = true;
|
|
7519
7519
|
let iterationCount = 0;
|
|
@@ -7521,43 +7521,40 @@ const resolveReExportChains = (graph) => {
|
|
|
7521
7521
|
didChange = false;
|
|
7522
7522
|
iterationCount++;
|
|
7523
7523
|
for (const module of graph.modules) {
|
|
7524
|
-
const
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
if (
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
didChange = true;
|
|
7550
|
-
}
|
|
7551
|
-
}
|
|
7524
|
+
const namespaceReExport = module.exports.find((exportInfo) => exportInfo.isReExport && exportInfo.reExportSource !== void 0 && exportInfo.isNamespaceReExport);
|
|
7525
|
+
if (!namespaceReExport) continue;
|
|
7526
|
+
const targetIndices = sourceToWildcardTargets.get(module.fileId.index);
|
|
7527
|
+
if (!targetIndices) continue;
|
|
7528
|
+
const existingExportNames = new Set(module.exports.filter((exportInfo) => !exportInfo.isNamespaceReExport).map((exportInfo) => exportInfo.name));
|
|
7529
|
+
for (const targetIndex of targetIndices) {
|
|
7530
|
+
const targetModule = graph.modules[targetIndex];
|
|
7531
|
+
if (!targetModule) continue;
|
|
7532
|
+
for (const targetExport of targetModule.exports) {
|
|
7533
|
+
if (targetExport.name === "*" && targetExport.isNamespaceReExport) continue;
|
|
7534
|
+
if (existingExportNames.has(targetExport.name)) continue;
|
|
7535
|
+
existingExportNames.add(targetExport.name);
|
|
7536
|
+
module.exports.push({
|
|
7537
|
+
name: targetExport.name,
|
|
7538
|
+
isDefault: targetExport.isDefault,
|
|
7539
|
+
isTypeOnly: targetExport.isTypeOnly || namespaceReExport.isTypeOnly,
|
|
7540
|
+
isReExport: true,
|
|
7541
|
+
isSynthetic: true,
|
|
7542
|
+
reExportSource: namespaceReExport.reExportSource,
|
|
7543
|
+
reExportOriginalName: targetExport.name,
|
|
7544
|
+
isNamespaceReExport: false,
|
|
7545
|
+
line: namespaceReExport.line,
|
|
7546
|
+
column: namespaceReExport.column
|
|
7547
|
+
});
|
|
7548
|
+
didChange = true;
|
|
7552
7549
|
}
|
|
7553
7550
|
}
|
|
7554
7551
|
}
|
|
7555
7552
|
}
|
|
7556
7553
|
};
|
|
7557
|
-
const
|
|
7554
|
+
const buildSourceWildcardTargetMap = (graph) => {
|
|
7558
7555
|
const sourceTargets = /* @__PURE__ */ new Map();
|
|
7559
7556
|
for (const edge of graph.edges) {
|
|
7560
|
-
if (!edge.isReExportEdge) continue;
|
|
7557
|
+
if (!edge.isReExportEdge || !edge.reExportedNames.includes("*")) continue;
|
|
7561
7558
|
const existing = sourceTargets.get(edge.source);
|
|
7562
7559
|
if (existing) {
|
|
7563
7560
|
if (!existing.includes(edge.target)) existing.push(edge.target);
|
package/dist/index.mjs
CHANGED
|
@@ -7480,7 +7480,7 @@ const traceReachability = (graph) => {
|
|
|
7480
7480
|
//#endregion
|
|
7481
7481
|
//#region src/linker/re-exports.ts
|
|
7482
7482
|
const resolveReExportChains = (graph) => {
|
|
7483
|
-
const
|
|
7483
|
+
const sourceToWildcardTargets = buildSourceWildcardTargetMap(graph);
|
|
7484
7484
|
const maxIterations = graph.modules.length * 2 + 1;
|
|
7485
7485
|
let didChange = true;
|
|
7486
7486
|
let iterationCount = 0;
|
|
@@ -7488,43 +7488,40 @@ const resolveReExportChains = (graph) => {
|
|
|
7488
7488
|
didChange = false;
|
|
7489
7489
|
iterationCount++;
|
|
7490
7490
|
for (const module of graph.modules) {
|
|
7491
|
-
const
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
if (
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
didChange = true;
|
|
7517
|
-
}
|
|
7518
|
-
}
|
|
7491
|
+
const namespaceReExport = module.exports.find((exportInfo) => exportInfo.isReExport && exportInfo.reExportSource !== void 0 && exportInfo.isNamespaceReExport);
|
|
7492
|
+
if (!namespaceReExport) continue;
|
|
7493
|
+
const targetIndices = sourceToWildcardTargets.get(module.fileId.index);
|
|
7494
|
+
if (!targetIndices) continue;
|
|
7495
|
+
const existingExportNames = new Set(module.exports.filter((exportInfo) => !exportInfo.isNamespaceReExport).map((exportInfo) => exportInfo.name));
|
|
7496
|
+
for (const targetIndex of targetIndices) {
|
|
7497
|
+
const targetModule = graph.modules[targetIndex];
|
|
7498
|
+
if (!targetModule) continue;
|
|
7499
|
+
for (const targetExport of targetModule.exports) {
|
|
7500
|
+
if (targetExport.name === "*" && targetExport.isNamespaceReExport) continue;
|
|
7501
|
+
if (existingExportNames.has(targetExport.name)) continue;
|
|
7502
|
+
existingExportNames.add(targetExport.name);
|
|
7503
|
+
module.exports.push({
|
|
7504
|
+
name: targetExport.name,
|
|
7505
|
+
isDefault: targetExport.isDefault,
|
|
7506
|
+
isTypeOnly: targetExport.isTypeOnly || namespaceReExport.isTypeOnly,
|
|
7507
|
+
isReExport: true,
|
|
7508
|
+
isSynthetic: true,
|
|
7509
|
+
reExportSource: namespaceReExport.reExportSource,
|
|
7510
|
+
reExportOriginalName: targetExport.name,
|
|
7511
|
+
isNamespaceReExport: false,
|
|
7512
|
+
line: namespaceReExport.line,
|
|
7513
|
+
column: namespaceReExport.column
|
|
7514
|
+
});
|
|
7515
|
+
didChange = true;
|
|
7519
7516
|
}
|
|
7520
7517
|
}
|
|
7521
7518
|
}
|
|
7522
7519
|
}
|
|
7523
7520
|
};
|
|
7524
|
-
const
|
|
7521
|
+
const buildSourceWildcardTargetMap = (graph) => {
|
|
7525
7522
|
const sourceTargets = /* @__PURE__ */ new Map();
|
|
7526
7523
|
for (const edge of graph.edges) {
|
|
7527
|
-
if (!edge.isReExportEdge) continue;
|
|
7524
|
+
if (!edge.isReExportEdge || !edge.reExportedNames.includes("*")) continue;
|
|
7528
7525
|
const existing = sourceTargets.get(edge.source);
|
|
7529
7526
|
if (existing) {
|
|
7530
7527
|
if (!existing.includes(edge.target)) existing.push(edge.target);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deslop-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Remove AI slop from JavaScript code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dead-code",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@oxc-project/types": "^0.
|
|
66
|
+
"@oxc-project/types": "^0.141.0",
|
|
67
67
|
"fast-glob": "^3.3.3",
|
|
68
68
|
"minimatch": "^10.2.5",
|
|
69
|
-
"oxc-parser": "^0.
|
|
70
|
-
"oxc-resolver": "^11.
|
|
69
|
+
"oxc-parser": "^0.141.0",
|
|
70
|
+
"oxc-resolver": "^11.24.2",
|
|
71
71
|
"typescript": ">=5.0.4 <6"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|