deslop-js 0.7.2 → 0.7.4

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 CHANGED
@@ -7557,6 +7557,7 @@ const resolveReExportChains = (graph) => {
7557
7557
  const buildSourceTargetMap = (graph) => {
7558
7558
  const sourceTargets = /* @__PURE__ */ new Map();
7559
7559
  for (const edge of graph.edges) {
7560
+ if (!edge.isReExportEdge) continue;
7560
7561
  const existing = sourceTargets.get(edge.source);
7561
7562
  if (existing) {
7562
7563
  if (!existing.includes(edge.target)) existing.push(edge.target);
@@ -7741,6 +7742,7 @@ const extractAccessedMemberNames = (memberAccesses, objectName) => {
7741
7742
  const buildSourceToTargetsMap = (graph) => {
7742
7743
  const sourceToTargets = /* @__PURE__ */ new Map();
7743
7744
  for (const edge of graph.edges) {
7745
+ if (!edge.isReExportEdge) continue;
7744
7746
  const existing = sourceToTargets.get(edge.source);
7745
7747
  if (existing) {
7746
7748
  if (!existing.includes(edge.target)) existing.push(edge.target);
@@ -13523,9 +13525,13 @@ const analyze = async (config) => {
13523
13525
  if (discoveredFilePaths.has(resolvedImport.resolvedPath)) continue;
13524
13526
  if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && (0, node_fs.existsSync)(resolvedImport.resolvedPath)) styleFilesToAdd.add(resolvedImport.resolvedPath);
13525
13527
  }
13526
- const sortedStyleFiles = [...styleFilesToAdd].sort();
13528
+ const styleFileQueue = [...styleFilesToAdd].sort();
13527
13529
  let nextFileIndex = files.length;
13528
- for (const styleFilePath of sortedStyleFiles) {
13530
+ let styleFileQueueIndex = 0;
13531
+ while (styleFileQueueIndex < styleFileQueue.length) {
13532
+ const styleFilePath = styleFileQueue[styleFileQueueIndex];
13533
+ styleFileQueueIndex++;
13534
+ if (discoveredFilePaths.has(styleFilePath)) continue;
13529
13535
  const styleSourceFile = {
13530
13536
  index: nextFileIndex,
13531
13537
  path: styleFilePath
@@ -13551,7 +13557,10 @@ const analyze = async (config) => {
13551
13557
  }
13552
13558
  resolvedStyleImportMap.set(importInfo.specifier, resolvedImport);
13553
13559
  if (resolvedImport.resolvedPath && !discoveredFilePaths.has(resolvedImport.resolvedPath)) {
13554
- if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && (0, node_fs.existsSync)(resolvedImport.resolvedPath)) styleFilesToAdd.add(resolvedImport.resolvedPath);
13560
+ if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && !styleFilesToAdd.has(resolvedImport.resolvedPath) && (0, node_fs.existsSync)(resolvedImport.resolvedPath)) {
13561
+ styleFilesToAdd.add(resolvedImport.resolvedPath);
13562
+ styleFileQueue.push(resolvedImport.resolvedPath);
13563
+ }
13555
13564
  }
13556
13565
  }
13557
13566
  graphInputs.push({
package/dist/index.mjs CHANGED
@@ -7524,6 +7524,7 @@ const resolveReExportChains = (graph) => {
7524
7524
  const buildSourceTargetMap = (graph) => {
7525
7525
  const sourceTargets = /* @__PURE__ */ new Map();
7526
7526
  for (const edge of graph.edges) {
7527
+ if (!edge.isReExportEdge) continue;
7527
7528
  const existing = sourceTargets.get(edge.source);
7528
7529
  if (existing) {
7529
7530
  if (!existing.includes(edge.target)) existing.push(edge.target);
@@ -7708,6 +7709,7 @@ const extractAccessedMemberNames = (memberAccesses, objectName) => {
7708
7709
  const buildSourceToTargetsMap = (graph) => {
7709
7710
  const sourceToTargets = /* @__PURE__ */ new Map();
7710
7711
  for (const edge of graph.edges) {
7712
+ if (!edge.isReExportEdge) continue;
7711
7713
  const existing = sourceToTargets.get(edge.source);
7712
7714
  if (existing) {
7713
7715
  if (!existing.includes(edge.target)) existing.push(edge.target);
@@ -13490,9 +13492,13 @@ const analyze = async (config) => {
13490
13492
  if (discoveredFilePaths.has(resolvedImport.resolvedPath)) continue;
13491
13493
  if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && existsSync(resolvedImport.resolvedPath)) styleFilesToAdd.add(resolvedImport.resolvedPath);
13492
13494
  }
13493
- const sortedStyleFiles = [...styleFilesToAdd].sort();
13495
+ const styleFileQueue = [...styleFilesToAdd].sort();
13494
13496
  let nextFileIndex = files.length;
13495
- for (const styleFilePath of sortedStyleFiles) {
13497
+ let styleFileQueueIndex = 0;
13498
+ while (styleFileQueueIndex < styleFileQueue.length) {
13499
+ const styleFilePath = styleFileQueue[styleFileQueueIndex];
13500
+ styleFileQueueIndex++;
13501
+ if (discoveredFilePaths.has(styleFilePath)) continue;
13496
13502
  const styleSourceFile = {
13497
13503
  index: nextFileIndex,
13498
13504
  path: styleFilePath
@@ -13518,7 +13524,10 @@ const analyze = async (config) => {
13518
13524
  }
13519
13525
  resolvedStyleImportMap.set(importInfo.specifier, resolvedImport);
13520
13526
  if (resolvedImport.resolvedPath && !discoveredFilePaths.has(resolvedImport.resolvedPath)) {
13521
- if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && existsSync(resolvedImport.resolvedPath)) styleFilesToAdd.add(resolvedImport.resolvedPath);
13527
+ if (STYLE_EXTENSIONS.some((ext) => resolvedImport.resolvedPath.endsWith(ext)) && !styleFilesToAdd.has(resolvedImport.resolvedPath) && existsSync(resolvedImport.resolvedPath)) {
13528
+ styleFilesToAdd.add(resolvedImport.resolvedPath);
13529
+ styleFileQueue.push(resolvedImport.resolvedPath);
13530
+ }
13522
13531
  }
13523
13532
  }
13524
13533
  graphInputs.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deslop-js",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Remove AI slop from JavaScript code.",
5
5
  "keywords": [
6
6
  "dead-code",