deslop-js 0.0.6 → 0.0.7

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
@@ -196,7 +196,11 @@ const IMPLICIT_DEPENDENCIES = new Set([
196
196
  "terser",
197
197
  "autoprefixer",
198
198
  "tailwindcss",
199
- "react-test-renderer"
199
+ "react-test-renderer",
200
+ "esbuild",
201
+ "typedoc",
202
+ "commitizen",
203
+ "cz-conventional-changelog"
200
204
  ]);
201
205
  const BUILTIN_MODULES = new Set([
202
206
  "assert",
@@ -4509,13 +4513,15 @@ const EXCLUDED_EXTENSIONS = new Set([
4509
4513
  ".graphql",
4510
4514
  ".gql"
4511
4515
  ]);
4512
- const TEST_FILE_PATTERN = /(?:\.(?:test|spec|stories|story)\.|(?:^|\/)__tests__\/)/;
4516
+ const TEST_FILE_PATTERN = /(?:\.(?:test|spec|stories|story|cy)\.|(?:^|\/)__tests__\/)/;
4517
+ const EXCLUDED_DIRECTORY_PATTERN = /(?:^|\/)(?:e2e|cypress|playwright|__fixtures__|__snapshots__|scripts)\/(?!.*node_modules)/;
4518
+ const CONFIG_FILE_PATTERN = /(?:^|\/)(?:[^/]+\.config\.[tj]sx?$|[^/]+\.setup\.[tj]sx?$|setupTests\.[tj]sx?$|jest\.setup\.[tj]sx?$|vitest\.setup\.[tj]sx?$)/;
4513
4519
  const hasExcludedExtension = (filePath) => {
4514
4520
  const lastDot = filePath.lastIndexOf(".");
4515
4521
  if (lastDot === -1) return false;
4516
4522
  return EXCLUDED_EXTENSIONS.has(filePath.slice(lastDot));
4517
4523
  };
4518
- const isTestFile = (filePath) => TEST_FILE_PATTERN.test(filePath);
4524
+ const isExcludedByPattern = (filePath) => TEST_FILE_PATTERN.test(filePath) || EXCLUDED_DIRECTORY_PATTERN.test(filePath) || CONFIG_FILE_PATTERN.test(filePath);
4519
4525
  const detectOrphanFiles = (graph) => {
4520
4526
  const unusedFiles = [];
4521
4527
  for (const module of graph.modules) {
@@ -4524,7 +4530,7 @@ const detectOrphanFiles = (graph) => {
4524
4530
  if (module.isDeclarationFile) continue;
4525
4531
  if (module.isConfigFile) continue;
4526
4532
  if (hasExcludedExtension(module.fileId.path)) continue;
4527
- if (isTestFile(module.fileId.path)) continue;
4533
+ if (isExcludedByPattern(module.fileId.path)) continue;
4528
4534
  if (isBarrelWithReachableSources(module, graph)) continue;
4529
4535
  if (hasReachableDirectImporter(module.fileId.index, graph)) continue;
4530
4536
  unusedFiles.push({ path: module.fileId.path });
@@ -5006,7 +5012,11 @@ const PACKAGE_JSON_CONFIG_SECTIONS = [
5006
5012
  "commitlint",
5007
5013
  "browserslist",
5008
5014
  "postcss",
5009
- "ava"
5015
+ "ava",
5016
+ "config",
5017
+ "pnpm",
5018
+ "resolutions",
5019
+ "overrides"
5010
5020
  ];
5011
5021
  const collectPackageJsonConfigReferences = (packageJsonPath, declaredNames) => {
5012
5022
  const referenced = /* @__PURE__ */ new Set();
@@ -5145,6 +5155,7 @@ const ALWAYS_USED_PREFIXES = [
5145
5155
  "postcss-",
5146
5156
  "@tailwindcss/",
5147
5157
  "rollup-plugin-",
5158
+ "@rollup/",
5148
5159
  "vite-plugin-",
5149
5160
  "@vitejs/",
5150
5161
  "webpack-",
package/dist/index.mjs CHANGED
@@ -166,7 +166,11 @@ const IMPLICIT_DEPENDENCIES = new Set([
166
166
  "terser",
167
167
  "autoprefixer",
168
168
  "tailwindcss",
169
- "react-test-renderer"
169
+ "react-test-renderer",
170
+ "esbuild",
171
+ "typedoc",
172
+ "commitizen",
173
+ "cz-conventional-changelog"
170
174
  ]);
171
175
  const BUILTIN_MODULES = new Set([
172
176
  "assert",
@@ -4479,13 +4483,15 @@ const EXCLUDED_EXTENSIONS = new Set([
4479
4483
  ".graphql",
4480
4484
  ".gql"
4481
4485
  ]);
4482
- const TEST_FILE_PATTERN = /(?:\.(?:test|spec|stories|story)\.|(?:^|\/)__tests__\/)/;
4486
+ const TEST_FILE_PATTERN = /(?:\.(?:test|spec|stories|story|cy)\.|(?:^|\/)__tests__\/)/;
4487
+ const EXCLUDED_DIRECTORY_PATTERN = /(?:^|\/)(?:e2e|cypress|playwright|__fixtures__|__snapshots__|scripts)\/(?!.*node_modules)/;
4488
+ const CONFIG_FILE_PATTERN = /(?:^|\/)(?:[^/]+\.config\.[tj]sx?$|[^/]+\.setup\.[tj]sx?$|setupTests\.[tj]sx?$|jest\.setup\.[tj]sx?$|vitest\.setup\.[tj]sx?$)/;
4483
4489
  const hasExcludedExtension = (filePath) => {
4484
4490
  const lastDot = filePath.lastIndexOf(".");
4485
4491
  if (lastDot === -1) return false;
4486
4492
  return EXCLUDED_EXTENSIONS.has(filePath.slice(lastDot));
4487
4493
  };
4488
- const isTestFile = (filePath) => TEST_FILE_PATTERN.test(filePath);
4494
+ const isExcludedByPattern = (filePath) => TEST_FILE_PATTERN.test(filePath) || EXCLUDED_DIRECTORY_PATTERN.test(filePath) || CONFIG_FILE_PATTERN.test(filePath);
4489
4495
  const detectOrphanFiles = (graph) => {
4490
4496
  const unusedFiles = [];
4491
4497
  for (const module of graph.modules) {
@@ -4494,7 +4500,7 @@ const detectOrphanFiles = (graph) => {
4494
4500
  if (module.isDeclarationFile) continue;
4495
4501
  if (module.isConfigFile) continue;
4496
4502
  if (hasExcludedExtension(module.fileId.path)) continue;
4497
- if (isTestFile(module.fileId.path)) continue;
4503
+ if (isExcludedByPattern(module.fileId.path)) continue;
4498
4504
  if (isBarrelWithReachableSources(module, graph)) continue;
4499
4505
  if (hasReachableDirectImporter(module.fileId.index, graph)) continue;
4500
4506
  unusedFiles.push({ path: module.fileId.path });
@@ -4976,7 +4982,11 @@ const PACKAGE_JSON_CONFIG_SECTIONS = [
4976
4982
  "commitlint",
4977
4983
  "browserslist",
4978
4984
  "postcss",
4979
- "ava"
4985
+ "ava",
4986
+ "config",
4987
+ "pnpm",
4988
+ "resolutions",
4989
+ "overrides"
4980
4990
  ];
4981
4991
  const collectPackageJsonConfigReferences = (packageJsonPath, declaredNames) => {
4982
4992
  const referenced = /* @__PURE__ */ new Set();
@@ -5115,6 +5125,7 @@ const ALWAYS_USED_PREFIXES = [
5115
5125
  "postcss-",
5116
5126
  "@tailwindcss/",
5117
5127
  "rollup-plugin-",
5128
+ "@rollup/",
5118
5129
  "vite-plugin-",
5119
5130
  "@vitejs/",
5120
5131
  "webpack-",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deslop-js",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Deslop JavaScript code",
5
5
  "keywords": [
6
6
  "dead-code",