deslop-js 0.0.25-dev.aeeb44a → 0.0.25

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
@@ -268,13 +268,6 @@ const PLATFORM_SUFFIXES = [
268
268
  ".server",
269
269
  ".client"
270
270
  ];
271
- const REACT_NATIVE_PLATFORM_SUFFIXES = [
272
- ".web",
273
- ".react-native",
274
- ".native",
275
- ".ios",
276
- ".android"
277
- ];
278
271
  const REACT_NATIVE_PLATFORM_EXTENSIONS = [
279
272
  ".web.ts",
280
273
  ".web.tsx",
@@ -7778,21 +7771,10 @@ const hasReachableDirectImporter = (targetModuleIndex, graph) => {
7778
7771
  return false;
7779
7772
  };
7780
7773
 
7781
- //#endregion
7782
- //#region src/utils/platform-stripped-base-path.ts
7783
- const platformStrippedBasePath = (modulePath, suffixes = PLATFORM_SUFFIXES) => {
7784
- const extensionIndex = modulePath.lastIndexOf(".");
7785
- if (extensionIndex === -1) return modulePath;
7786
- const withoutExtension = modulePath.slice(0, extensionIndex);
7787
- for (const suffix of suffixes) if (withoutExtension.endsWith(suffix)) return withoutExtension.slice(0, -suffix.length) + modulePath.slice(extensionIndex);
7788
- return modulePath;
7789
- };
7790
-
7791
7774
  //#endregion
7792
7775
  //#region src/report/exports.ts
7793
7776
  const detectDeadExports = (graph, config) => {
7794
7777
  const usageMap = buildUsageMap(graph);
7795
- const platformSiblingUsageKeys = graph.hasReactNative ? buildPlatformSiblingUsageKeys(usageMap) : void 0;
7796
7778
  const unusedExports = [];
7797
7779
  for (const module of graph.modules) {
7798
7780
  if (!module.isReachable) continue;
@@ -7807,7 +7789,6 @@ const detectDeadExports = (graph, config) => {
7807
7789
  if (!config.reportTypes && exportInfo.isTypeOnly) continue;
7808
7790
  const usageKey = `${module.fileId.path}::${exportInfo.name}`;
7809
7791
  if (usageMap.has(usageKey)) continue;
7810
- if (platformSiblingUsageKeys?.has(`${platformStrippedBasePath(module.fileId.path, REACT_NATIVE_PLATFORM_SUFFIXES)}::${exportInfo.name}`)) continue;
7811
7792
  if (module.localIdentifierReferences.includes(exportInfo.name)) continue;
7812
7793
  if (!exportInfo.isDefault && defaultExportLinkedNames.has(exportInfo.name)) continue;
7813
7794
  unusedExports.push({
@@ -7821,18 +7802,6 @@ const detectDeadExports = (graph, config) => {
7821
7802
  }
7822
7803
  return unusedExports;
7823
7804
  };
7824
- const buildPlatformSiblingUsageKeys = (usageMap) => {
7825
- const baseKeys = /* @__PURE__ */ new Set();
7826
- for (const usageKey of usageMap) {
7827
- const separatorIndex = usageKey.lastIndexOf("::");
7828
- if (separatorIndex === -1) continue;
7829
- const filePath = usageKey.slice(0, separatorIndex);
7830
- const exportName = usageKey.slice(separatorIndex + 2);
7831
- const basePath = platformStrippedBasePath(filePath, REACT_NATIVE_PLATFORM_SUFFIXES);
7832
- baseKeys.add(`${basePath}::${exportName}`);
7833
- }
7834
- return baseKeys;
7835
- };
7836
7805
  const buildUsageMap = (graph) => {
7837
7806
  const usedExportKeys = /* @__PURE__ */ new Set();
7838
7807
  const sourceToTargetMap = buildSourceToTargetsMap(graph);
@@ -8909,7 +8878,19 @@ const detectCycles = (graph) => {
8909
8878
 
8910
8879
  //#endregion
8911
8880
  //#region src/report/redundancy.ts
8912
- const isPlatformSpecificModulePath = (modulePath) => platformStrippedBasePath(modulePath) !== modulePath;
8881
+ const isPlatformSpecificModulePath = (modulePath) => {
8882
+ const extensionIndex = modulePath.lastIndexOf(".");
8883
+ if (extensionIndex === -1) return false;
8884
+ const withoutExtension = modulePath.slice(0, extensionIndex);
8885
+ return PLATFORM_SUFFIXES.some((suffix) => withoutExtension.endsWith(suffix));
8886
+ };
8887
+ const platformStrippedBasePath = (modulePath) => {
8888
+ const extensionIndex = modulePath.lastIndexOf(".");
8889
+ if (extensionIndex === -1) return modulePath;
8890
+ const withoutExtension = modulePath.slice(0, extensionIndex);
8891
+ for (const suffix of PLATFORM_SUFFIXES) if (withoutExtension.endsWith(suffix)) return withoutExtension.slice(0, -suffix.length) + modulePath.slice(extensionIndex);
8892
+ return modulePath;
8893
+ };
8913
8894
  const buildPlatformSiblingGroupSizes = (graph) => {
8914
8895
  const baseToCount = /* @__PURE__ */ new Map();
8915
8896
  for (const module of graph.modules) {
@@ -13243,7 +13224,6 @@ const analyze = async (config) => {
13243
13224
  }));
13244
13225
  return buildEmptyScanResult(setupErrors, performance.now() - pipelineStartTime);
13245
13226
  }
13246
- moduleGraph.hasReactNative = hasReactNative;
13247
13227
  try {
13248
13228
  resolveReExportChains(moduleGraph);
13249
13229
  } catch (reExportError) {
package/dist/index.mjs CHANGED
@@ -236,13 +236,6 @@ const PLATFORM_SUFFIXES = [
236
236
  ".server",
237
237
  ".client"
238
238
  ];
239
- const REACT_NATIVE_PLATFORM_SUFFIXES = [
240
- ".web",
241
- ".react-native",
242
- ".native",
243
- ".ios",
244
- ".android"
245
- ];
246
239
  const REACT_NATIVE_PLATFORM_EXTENSIONS = [
247
240
  ".web.ts",
248
241
  ".web.tsx",
@@ -7746,21 +7739,10 @@ const hasReachableDirectImporter = (targetModuleIndex, graph) => {
7746
7739
  return false;
7747
7740
  };
7748
7741
 
7749
- //#endregion
7750
- //#region src/utils/platform-stripped-base-path.ts
7751
- const platformStrippedBasePath = (modulePath, suffixes = PLATFORM_SUFFIXES) => {
7752
- const extensionIndex = modulePath.lastIndexOf(".");
7753
- if (extensionIndex === -1) return modulePath;
7754
- const withoutExtension = modulePath.slice(0, extensionIndex);
7755
- for (const suffix of suffixes) if (withoutExtension.endsWith(suffix)) return withoutExtension.slice(0, -suffix.length) + modulePath.slice(extensionIndex);
7756
- return modulePath;
7757
- };
7758
-
7759
7742
  //#endregion
7760
7743
  //#region src/report/exports.ts
7761
7744
  const detectDeadExports = (graph, config) => {
7762
7745
  const usageMap = buildUsageMap(graph);
7763
- const platformSiblingUsageKeys = graph.hasReactNative ? buildPlatformSiblingUsageKeys(usageMap) : void 0;
7764
7746
  const unusedExports = [];
7765
7747
  for (const module of graph.modules) {
7766
7748
  if (!module.isReachable) continue;
@@ -7775,7 +7757,6 @@ const detectDeadExports = (graph, config) => {
7775
7757
  if (!config.reportTypes && exportInfo.isTypeOnly) continue;
7776
7758
  const usageKey = `${module.fileId.path}::${exportInfo.name}`;
7777
7759
  if (usageMap.has(usageKey)) continue;
7778
- if (platformSiblingUsageKeys?.has(`${platformStrippedBasePath(module.fileId.path, REACT_NATIVE_PLATFORM_SUFFIXES)}::${exportInfo.name}`)) continue;
7779
7760
  if (module.localIdentifierReferences.includes(exportInfo.name)) continue;
7780
7761
  if (!exportInfo.isDefault && defaultExportLinkedNames.has(exportInfo.name)) continue;
7781
7762
  unusedExports.push({
@@ -7789,18 +7770,6 @@ const detectDeadExports = (graph, config) => {
7789
7770
  }
7790
7771
  return unusedExports;
7791
7772
  };
7792
- const buildPlatformSiblingUsageKeys = (usageMap) => {
7793
- const baseKeys = /* @__PURE__ */ new Set();
7794
- for (const usageKey of usageMap) {
7795
- const separatorIndex = usageKey.lastIndexOf("::");
7796
- if (separatorIndex === -1) continue;
7797
- const filePath = usageKey.slice(0, separatorIndex);
7798
- const exportName = usageKey.slice(separatorIndex + 2);
7799
- const basePath = platformStrippedBasePath(filePath, REACT_NATIVE_PLATFORM_SUFFIXES);
7800
- baseKeys.add(`${basePath}::${exportName}`);
7801
- }
7802
- return baseKeys;
7803
- };
7804
7773
  const buildUsageMap = (graph) => {
7805
7774
  const usedExportKeys = /* @__PURE__ */ new Set();
7806
7775
  const sourceToTargetMap = buildSourceToTargetsMap(graph);
@@ -8877,7 +8846,19 @@ const detectCycles = (graph) => {
8877
8846
 
8878
8847
  //#endregion
8879
8848
  //#region src/report/redundancy.ts
8880
- const isPlatformSpecificModulePath = (modulePath) => platformStrippedBasePath(modulePath) !== modulePath;
8849
+ const isPlatformSpecificModulePath = (modulePath) => {
8850
+ const extensionIndex = modulePath.lastIndexOf(".");
8851
+ if (extensionIndex === -1) return false;
8852
+ const withoutExtension = modulePath.slice(0, extensionIndex);
8853
+ return PLATFORM_SUFFIXES.some((suffix) => withoutExtension.endsWith(suffix));
8854
+ };
8855
+ const platformStrippedBasePath = (modulePath) => {
8856
+ const extensionIndex = modulePath.lastIndexOf(".");
8857
+ if (extensionIndex === -1) return modulePath;
8858
+ const withoutExtension = modulePath.slice(0, extensionIndex);
8859
+ for (const suffix of PLATFORM_SUFFIXES) if (withoutExtension.endsWith(suffix)) return withoutExtension.slice(0, -suffix.length) + modulePath.slice(extensionIndex);
8860
+ return modulePath;
8861
+ };
8881
8862
  const buildPlatformSiblingGroupSizes = (graph) => {
8882
8863
  const baseToCount = /* @__PURE__ */ new Map();
8883
8864
  for (const module of graph.modules) {
@@ -13211,7 +13192,6 @@ const analyze = async (config) => {
13211
13192
  }));
13212
13193
  return buildEmptyScanResult(setupErrors, performance.now() - pipelineStartTime);
13213
13194
  }
13214
- moduleGraph.hasReactNative = hasReactNative;
13215
13195
  try {
13216
13196
  resolveReExportChains(moduleGraph);
13217
13197
  } catch (reExportError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deslop-js",
3
- "version": "0.0.25-dev.aeeb44a",
3
+ "version": "0.0.25",
4
4
  "description": "Deslop JavaScript code",
5
5
  "keywords": [
6
6
  "dead-code",