driftdetect-detectors 0.1.0

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.
Files changed (509) hide show
  1. package/dist/accessibility/alt-text.d.ts +63 -0
  2. package/dist/accessibility/alt-text.d.ts.map +1 -0
  3. package/dist/accessibility/alt-text.js +100 -0
  4. package/dist/accessibility/alt-text.js.map +1 -0
  5. package/dist/accessibility/aria-roles.d.ts +65 -0
  6. package/dist/accessibility/aria-roles.d.ts.map +1 -0
  7. package/dist/accessibility/aria-roles.js +87 -0
  8. package/dist/accessibility/aria-roles.js.map +1 -0
  9. package/dist/accessibility/focus-management.d.ts +62 -0
  10. package/dist/accessibility/focus-management.d.ts.map +1 -0
  11. package/dist/accessibility/focus-management.js +88 -0
  12. package/dist/accessibility/focus-management.js.map +1 -0
  13. package/dist/accessibility/heading-hierarchy.d.ts +66 -0
  14. package/dist/accessibility/heading-hierarchy.d.ts.map +1 -0
  15. package/dist/accessibility/heading-hierarchy.js +94 -0
  16. package/dist/accessibility/heading-hierarchy.js.map +1 -0
  17. package/dist/accessibility/index.d.ts +25 -0
  18. package/dist/accessibility/index.d.ts.map +1 -0
  19. package/dist/accessibility/index.js +21 -0
  20. package/dist/accessibility/index.js.map +1 -0
  21. package/dist/accessibility/keyboard-nav.d.ts +63 -0
  22. package/dist/accessibility/keyboard-nav.d.ts.map +1 -0
  23. package/dist/accessibility/keyboard-nav.js +86 -0
  24. package/dist/accessibility/keyboard-nav.js.map +1 -0
  25. package/dist/accessibility/semantic-html.d.ts +76 -0
  26. package/dist/accessibility/semantic-html.d.ts.map +1 -0
  27. package/dist/accessibility/semantic-html.js +204 -0
  28. package/dist/accessibility/semantic-html.js.map +1 -0
  29. package/dist/api/client-patterns.d.ts +121 -0
  30. package/dist/api/client-patterns.d.ts.map +1 -0
  31. package/dist/api/client-patterns.js +478 -0
  32. package/dist/api/client-patterns.js.map +1 -0
  33. package/dist/api/error-format.d.ts +140 -0
  34. package/dist/api/error-format.d.ts.map +1 -0
  35. package/dist/api/error-format.js +614 -0
  36. package/dist/api/error-format.js.map +1 -0
  37. package/dist/api/http-methods.d.ts +255 -0
  38. package/dist/api/http-methods.d.ts.map +1 -0
  39. package/dist/api/http-methods.js +890 -0
  40. package/dist/api/http-methods.js.map +1 -0
  41. package/dist/api/index.d.ts +16 -0
  42. package/dist/api/index.d.ts.map +1 -0
  43. package/dist/api/index.js +37 -0
  44. package/dist/api/index.js.map +1 -0
  45. package/dist/api/pagination.d.ts +133 -0
  46. package/dist/api/pagination.d.ts.map +1 -0
  47. package/dist/api/pagination.js +521 -0
  48. package/dist/api/pagination.js.map +1 -0
  49. package/dist/api/response-envelope.d.ts +261 -0
  50. package/dist/api/response-envelope.d.ts.map +1 -0
  51. package/dist/api/response-envelope.js +1050 -0
  52. package/dist/api/response-envelope.js.map +1 -0
  53. package/dist/api/retry-patterns.d.ts +117 -0
  54. package/dist/api/retry-patterns.d.ts.map +1 -0
  55. package/dist/api/retry-patterns.js +480 -0
  56. package/dist/api/retry-patterns.js.map +1 -0
  57. package/dist/api/route-structure.d.ts +128 -0
  58. package/dist/api/route-structure.d.ts.map +1 -0
  59. package/dist/api/route-structure.js +738 -0
  60. package/dist/api/route-structure.js.map +1 -0
  61. package/dist/auth/audit-logging.d.ts +80 -0
  62. package/dist/auth/audit-logging.d.ts.map +1 -0
  63. package/dist/auth/audit-logging.js +370 -0
  64. package/dist/auth/audit-logging.js.map +1 -0
  65. package/dist/auth/index.d.ts +33 -0
  66. package/dist/auth/index.d.ts.map +1 -0
  67. package/dist/auth/index.js +49 -0
  68. package/dist/auth/index.js.map +1 -0
  69. package/dist/auth/middleware-usage.d.ts +65 -0
  70. package/dist/auth/middleware-usage.d.ts.map +1 -0
  71. package/dist/auth/middleware-usage.js +192 -0
  72. package/dist/auth/middleware-usage.js.map +1 -0
  73. package/dist/auth/permission-checks.d.ts +60 -0
  74. package/dist/auth/permission-checks.d.ts.map +1 -0
  75. package/dist/auth/permission-checks.js +159 -0
  76. package/dist/auth/permission-checks.js.map +1 -0
  77. package/dist/auth/rbac-patterns.d.ts +68 -0
  78. package/dist/auth/rbac-patterns.d.ts.map +1 -0
  79. package/dist/auth/rbac-patterns.js +143 -0
  80. package/dist/auth/rbac-patterns.js.map +1 -0
  81. package/dist/auth/resource-ownership.d.ts +77 -0
  82. package/dist/auth/resource-ownership.d.ts.map +1 -0
  83. package/dist/auth/resource-ownership.js +324 -0
  84. package/dist/auth/resource-ownership.js.map +1 -0
  85. package/dist/auth/token-handling.d.ts +64 -0
  86. package/dist/auth/token-handling.d.ts.map +1 -0
  87. package/dist/auth/token-handling.js +151 -0
  88. package/dist/auth/token-handling.js.map +1 -0
  89. package/dist/base/ast-detector.d.ts +421 -0
  90. package/dist/base/ast-detector.d.ts.map +1 -0
  91. package/dist/base/ast-detector.js +699 -0
  92. package/dist/base/ast-detector.js.map +1 -0
  93. package/dist/base/base-detector.d.ts +366 -0
  94. package/dist/base/base-detector.d.ts.map +1 -0
  95. package/dist/base/base-detector.js +170 -0
  96. package/dist/base/base-detector.js.map +1 -0
  97. package/dist/base/index.d.ts +12 -0
  98. package/dist/base/index.d.ts.map +1 -0
  99. package/dist/base/index.js +17 -0
  100. package/dist/base/index.js.map +1 -0
  101. package/dist/base/regex-detector.d.ts +421 -0
  102. package/dist/base/regex-detector.d.ts.map +1 -0
  103. package/dist/base/regex-detector.js +537 -0
  104. package/dist/base/regex-detector.js.map +1 -0
  105. package/dist/base/structural-detector.d.ts +424 -0
  106. package/dist/base/structural-detector.d.ts.map +1 -0
  107. package/dist/base/structural-detector.js +731 -0
  108. package/dist/base/structural-detector.js.map +1 -0
  109. package/dist/base/types.d.ts +53 -0
  110. package/dist/base/types.d.ts.map +1 -0
  111. package/dist/base/types.js +5 -0
  112. package/dist/base/types.js.map +1 -0
  113. package/dist/components/component-structure.d.ts +163 -0
  114. package/dist/components/component-structure.d.ts.map +1 -0
  115. package/dist/components/component-structure.js +500 -0
  116. package/dist/components/component-structure.js.map +1 -0
  117. package/dist/components/composition.d.ts +287 -0
  118. package/dist/components/composition.d.ts.map +1 -0
  119. package/dist/components/composition.js +1123 -0
  120. package/dist/components/composition.js.map +1 -0
  121. package/dist/components/duplicate-detection.d.ts +251 -0
  122. package/dist/components/duplicate-detection.d.ts.map +1 -0
  123. package/dist/components/duplicate-detection.js +804 -0
  124. package/dist/components/duplicate-detection.js.map +1 -0
  125. package/dist/components/index.d.ts +16 -0
  126. package/dist/components/index.d.ts.map +1 -0
  127. package/dist/components/index.js +51 -0
  128. package/dist/components/index.js.map +1 -0
  129. package/dist/components/near-duplicate.d.ts +402 -0
  130. package/dist/components/near-duplicate.d.ts.map +1 -0
  131. package/dist/components/near-duplicate.js +1090 -0
  132. package/dist/components/near-duplicate.js.map +1 -0
  133. package/dist/components/props-patterns.d.ts +194 -0
  134. package/dist/components/props-patterns.d.ts.map +1 -0
  135. package/dist/components/props-patterns.js +795 -0
  136. package/dist/components/props-patterns.js.map +1 -0
  137. package/dist/components/ref-forwarding.d.ts +250 -0
  138. package/dist/components/ref-forwarding.d.ts.map +1 -0
  139. package/dist/components/ref-forwarding.js +832 -0
  140. package/dist/components/ref-forwarding.js.map +1 -0
  141. package/dist/components/state-patterns.d.ts +291 -0
  142. package/dist/components/state-patterns.d.ts.map +1 -0
  143. package/dist/components/state-patterns.js +970 -0
  144. package/dist/components/state-patterns.js.map +1 -0
  145. package/dist/config/config-validation.d.ts +74 -0
  146. package/dist/config/config-validation.d.ts.map +1 -0
  147. package/dist/config/config-validation.js +446 -0
  148. package/dist/config/config-validation.js.map +1 -0
  149. package/dist/config/default-values.d.ts +72 -0
  150. package/dist/config/default-values.d.ts.map +1 -0
  151. package/dist/config/default-values.js +386 -0
  152. package/dist/config/default-values.js.map +1 -0
  153. package/dist/config/env-naming.d.ts +73 -0
  154. package/dist/config/env-naming.d.ts.map +1 -0
  155. package/dist/config/env-naming.js +429 -0
  156. package/dist/config/env-naming.js.map +1 -0
  157. package/dist/config/environment-detection.d.ts +72 -0
  158. package/dist/config/environment-detection.d.ts.map +1 -0
  159. package/dist/config/environment-detection.js +400 -0
  160. package/dist/config/environment-detection.js.map +1 -0
  161. package/dist/config/feature-flags.d.ts +72 -0
  162. package/dist/config/feature-flags.d.ts.map +1 -0
  163. package/dist/config/feature-flags.js +384 -0
  164. package/dist/config/feature-flags.js.map +1 -0
  165. package/dist/config/index.d.ts +27 -0
  166. package/dist/config/index.d.ts.map +1 -0
  167. package/dist/config/index.js +43 -0
  168. package/dist/config/index.js.map +1 -0
  169. package/dist/config/required-optional.d.ts +71 -0
  170. package/dist/config/required-optional.d.ts.map +1 -0
  171. package/dist/config/required-optional.js +344 -0
  172. package/dist/config/required-optional.js.map +1 -0
  173. package/dist/data-access/connection-pooling.d.ts +63 -0
  174. package/dist/data-access/connection-pooling.d.ts.map +1 -0
  175. package/dist/data-access/connection-pooling.js +297 -0
  176. package/dist/data-access/connection-pooling.js.map +1 -0
  177. package/dist/data-access/dto-patterns.d.ts +64 -0
  178. package/dist/data-access/dto-patterns.d.ts.map +1 -0
  179. package/dist/data-access/dto-patterns.js +291 -0
  180. package/dist/data-access/dto-patterns.js.map +1 -0
  181. package/dist/data-access/index.d.ts +31 -0
  182. package/dist/data-access/index.d.ts.map +1 -0
  183. package/dist/data-access/index.js +49 -0
  184. package/dist/data-access/index.js.map +1 -0
  185. package/dist/data-access/n-plus-one.d.ts +60 -0
  186. package/dist/data-access/n-plus-one.d.ts.map +1 -0
  187. package/dist/data-access/n-plus-one.js +264 -0
  188. package/dist/data-access/n-plus-one.js.map +1 -0
  189. package/dist/data-access/query-patterns.d.ts +64 -0
  190. package/dist/data-access/query-patterns.d.ts.map +1 -0
  191. package/dist/data-access/query-patterns.js +314 -0
  192. package/dist/data-access/query-patterns.js.map +1 -0
  193. package/dist/data-access/repository-pattern.d.ts +62 -0
  194. package/dist/data-access/repository-pattern.d.ts.map +1 -0
  195. package/dist/data-access/repository-pattern.js +257 -0
  196. package/dist/data-access/repository-pattern.js.map +1 -0
  197. package/dist/data-access/transaction-patterns.d.ts +61 -0
  198. package/dist/data-access/transaction-patterns.d.ts.map +1 -0
  199. package/dist/data-access/transaction-patterns.js +277 -0
  200. package/dist/data-access/transaction-patterns.js.map +1 -0
  201. package/dist/data-access/validation-patterns.d.ts +62 -0
  202. package/dist/data-access/validation-patterns.d.ts.map +1 -0
  203. package/dist/data-access/validation-patterns.js +301 -0
  204. package/dist/data-access/validation-patterns.js.map +1 -0
  205. package/dist/documentation/deprecation.d.ts +62 -0
  206. package/dist/documentation/deprecation.d.ts.map +1 -0
  207. package/dist/documentation/deprecation.js +83 -0
  208. package/dist/documentation/deprecation.js.map +1 -0
  209. package/dist/documentation/example-code.d.ts +64 -0
  210. package/dist/documentation/example-code.d.ts.map +1 -0
  211. package/dist/documentation/example-code.js +79 -0
  212. package/dist/documentation/example-code.js.map +1 -0
  213. package/dist/documentation/index.d.ts +22 -0
  214. package/dist/documentation/index.d.ts.map +1 -0
  215. package/dist/documentation/index.js +19 -0
  216. package/dist/documentation/index.js.map +1 -0
  217. package/dist/documentation/jsdoc-patterns.d.ts +72 -0
  218. package/dist/documentation/jsdoc-patterns.d.ts.map +1 -0
  219. package/dist/documentation/jsdoc-patterns.js +92 -0
  220. package/dist/documentation/jsdoc-patterns.js.map +1 -0
  221. package/dist/documentation/readme-structure.d.ts +67 -0
  222. package/dist/documentation/readme-structure.d.ts.map +1 -0
  223. package/dist/documentation/readme-structure.js +76 -0
  224. package/dist/documentation/readme-structure.js.map +1 -0
  225. package/dist/documentation/todo-patterns.d.ts +67 -0
  226. package/dist/documentation/todo-patterns.d.ts.map +1 -0
  227. package/dist/documentation/todo-patterns.js +73 -0
  228. package/dist/documentation/todo-patterns.js.map +1 -0
  229. package/dist/errors/async-errors.d.ts +72 -0
  230. package/dist/errors/async-errors.d.ts.map +1 -0
  231. package/dist/errors/async-errors.js +214 -0
  232. package/dist/errors/async-errors.js.map +1 -0
  233. package/dist/errors/circuit-breaker.d.ts +53 -0
  234. package/dist/errors/circuit-breaker.d.ts.map +1 -0
  235. package/dist/errors/circuit-breaker.js +241 -0
  236. package/dist/errors/circuit-breaker.js.map +1 -0
  237. package/dist/errors/error-codes.d.ts +73 -0
  238. package/dist/errors/error-codes.d.ts.map +1 -0
  239. package/dist/errors/error-codes.js +211 -0
  240. package/dist/errors/error-codes.js.map +1 -0
  241. package/dist/errors/error-logging.d.ts +73 -0
  242. package/dist/errors/error-logging.d.ts.map +1 -0
  243. package/dist/errors/error-logging.js +256 -0
  244. package/dist/errors/error-logging.js.map +1 -0
  245. package/dist/errors/error-propagation.d.ts +73 -0
  246. package/dist/errors/error-propagation.d.ts.map +1 -0
  247. package/dist/errors/error-propagation.js +244 -0
  248. package/dist/errors/error-propagation.js.map +1 -0
  249. package/dist/errors/exception-hierarchy.d.ts +75 -0
  250. package/dist/errors/exception-hierarchy.d.ts.map +1 -0
  251. package/dist/errors/exception-hierarchy.js +259 -0
  252. package/dist/errors/exception-hierarchy.js.map +1 -0
  253. package/dist/errors/index.d.ts +31 -0
  254. package/dist/errors/index.d.ts.map +1 -0
  255. package/dist/errors/index.js +49 -0
  256. package/dist/errors/index.js.map +1 -0
  257. package/dist/errors/try-catch-placement.d.ts +73 -0
  258. package/dist/errors/try-catch-placement.d.ts.map +1 -0
  259. package/dist/errors/try-catch-placement.js +214 -0
  260. package/dist/errors/try-catch-placement.js.map +1 -0
  261. package/dist/index.d.ts +221 -0
  262. package/dist/index.d.ts.map +1 -0
  263. package/dist/index.js +245 -0
  264. package/dist/index.js.map +1 -0
  265. package/dist/logging/context-fields.d.ts +48 -0
  266. package/dist/logging/context-fields.d.ts.map +1 -0
  267. package/dist/logging/context-fields.js +160 -0
  268. package/dist/logging/context-fields.js.map +1 -0
  269. package/dist/logging/correlation-ids.d.ts +44 -0
  270. package/dist/logging/correlation-ids.d.ts.map +1 -0
  271. package/dist/logging/correlation-ids.js +144 -0
  272. package/dist/logging/correlation-ids.js.map +1 -0
  273. package/dist/logging/health-checks.d.ts +45 -0
  274. package/dist/logging/health-checks.d.ts.map +1 -0
  275. package/dist/logging/health-checks.js +165 -0
  276. package/dist/logging/health-checks.js.map +1 -0
  277. package/dist/logging/index.d.ts +31 -0
  278. package/dist/logging/index.d.ts.map +1 -0
  279. package/dist/logging/index.js +49 -0
  280. package/dist/logging/index.js.map +1 -0
  281. package/dist/logging/log-levels.d.ts +46 -0
  282. package/dist/logging/log-levels.d.ts.map +1 -0
  283. package/dist/logging/log-levels.js +178 -0
  284. package/dist/logging/log-levels.js.map +1 -0
  285. package/dist/logging/metric-naming.d.ts +46 -0
  286. package/dist/logging/metric-naming.d.ts.map +1 -0
  287. package/dist/logging/metric-naming.js +157 -0
  288. package/dist/logging/metric-naming.js.map +1 -0
  289. package/dist/logging/pii-redaction.d.ts +44 -0
  290. package/dist/logging/pii-redaction.d.ts.map +1 -0
  291. package/dist/logging/pii-redaction.js +166 -0
  292. package/dist/logging/pii-redaction.js.map +1 -0
  293. package/dist/logging/structured-format.d.ts +53 -0
  294. package/dist/logging/structured-format.d.ts.map +1 -0
  295. package/dist/logging/structured-format.js +235 -0
  296. package/dist/logging/structured-format.js.map +1 -0
  297. package/dist/performance/bundle-size.d.ts +79 -0
  298. package/dist/performance/bundle-size.d.ts.map +1 -0
  299. package/dist/performance/bundle-size.js +276 -0
  300. package/dist/performance/bundle-size.js.map +1 -0
  301. package/dist/performance/caching-patterns.d.ts +78 -0
  302. package/dist/performance/caching-patterns.d.ts.map +1 -0
  303. package/dist/performance/caching-patterns.js +257 -0
  304. package/dist/performance/caching-patterns.js.map +1 -0
  305. package/dist/performance/code-splitting.d.ts +86 -0
  306. package/dist/performance/code-splitting.d.ts.map +1 -0
  307. package/dist/performance/code-splitting.js +447 -0
  308. package/dist/performance/code-splitting.js.map +1 -0
  309. package/dist/performance/debounce-throttle.d.ts +75 -0
  310. package/dist/performance/debounce-throttle.d.ts.map +1 -0
  311. package/dist/performance/debounce-throttle.js +232 -0
  312. package/dist/performance/debounce-throttle.js.map +1 -0
  313. package/dist/performance/index.d.ts +28 -0
  314. package/dist/performance/index.d.ts.map +1 -0
  315. package/dist/performance/index.js +39 -0
  316. package/dist/performance/index.js.map +1 -0
  317. package/dist/performance/lazy-loading.d.ts +75 -0
  318. package/dist/performance/lazy-loading.d.ts.map +1 -0
  319. package/dist/performance/lazy-loading.js +233 -0
  320. package/dist/performance/lazy-loading.js.map +1 -0
  321. package/dist/performance/memoization.d.ts +75 -0
  322. package/dist/performance/memoization.d.ts.map +1 -0
  323. package/dist/performance/memoization.js +251 -0
  324. package/dist/performance/memoization.js.map +1 -0
  325. package/dist/registry/detector-registry.d.ts +266 -0
  326. package/dist/registry/detector-registry.d.ts.map +1 -0
  327. package/dist/registry/detector-registry.js +526 -0
  328. package/dist/registry/detector-registry.js.map +1 -0
  329. package/dist/registry/index.d.ts +10 -0
  330. package/dist/registry/index.d.ts.map +1 -0
  331. package/dist/registry/index.js +10 -0
  332. package/dist/registry/index.js.map +1 -0
  333. package/dist/registry/loader.d.ts +232 -0
  334. package/dist/registry/loader.d.ts.map +1 -0
  335. package/dist/registry/loader.js +419 -0
  336. package/dist/registry/loader.js.map +1 -0
  337. package/dist/registry/types.d.ts +111 -0
  338. package/dist/registry/types.d.ts.map +1 -0
  339. package/dist/registry/types.js +19 -0
  340. package/dist/registry/types.js.map +1 -0
  341. package/dist/security/csp-headers.d.ts +78 -0
  342. package/dist/security/csp-headers.d.ts.map +1 -0
  343. package/dist/security/csp-headers.js +401 -0
  344. package/dist/security/csp-headers.js.map +1 -0
  345. package/dist/security/csrf-protection.d.ts +72 -0
  346. package/dist/security/csrf-protection.d.ts.map +1 -0
  347. package/dist/security/csrf-protection.js +344 -0
  348. package/dist/security/csrf-protection.js.map +1 -0
  349. package/dist/security/index.d.ts +30 -0
  350. package/dist/security/index.d.ts.map +1 -0
  351. package/dist/security/index.js +48 -0
  352. package/dist/security/index.js.map +1 -0
  353. package/dist/security/input-sanitization.d.ts +74 -0
  354. package/dist/security/input-sanitization.d.ts.map +1 -0
  355. package/dist/security/input-sanitization.js +373 -0
  356. package/dist/security/input-sanitization.js.map +1 -0
  357. package/dist/security/rate-limiting.d.ts +81 -0
  358. package/dist/security/rate-limiting.d.ts.map +1 -0
  359. package/dist/security/rate-limiting.js +535 -0
  360. package/dist/security/rate-limiting.js.map +1 -0
  361. package/dist/security/secret-management.d.ts +83 -0
  362. package/dist/security/secret-management.d.ts.map +1 -0
  363. package/dist/security/secret-management.js +547 -0
  364. package/dist/security/secret-management.js.map +1 -0
  365. package/dist/security/sql-injection.d.ts +76 -0
  366. package/dist/security/sql-injection.d.ts.map +1 -0
  367. package/dist/security/sql-injection.js +383 -0
  368. package/dist/security/sql-injection.js.map +1 -0
  369. package/dist/security/xss-prevention.d.ts +80 -0
  370. package/dist/security/xss-prevention.d.ts.map +1 -0
  371. package/dist/security/xss-prevention.js +416 -0
  372. package/dist/security/xss-prevention.js.map +1 -0
  373. package/dist/structural/barrel-exports.d.ts +178 -0
  374. package/dist/structural/barrel-exports.d.ts.map +1 -0
  375. package/dist/structural/barrel-exports.js +553 -0
  376. package/dist/structural/barrel-exports.js.map +1 -0
  377. package/dist/structural/circular-deps.d.ts +140 -0
  378. package/dist/structural/circular-deps.d.ts.map +1 -0
  379. package/dist/structural/circular-deps.js +422 -0
  380. package/dist/structural/circular-deps.js.map +1 -0
  381. package/dist/structural/co-location.d.ts +202 -0
  382. package/dist/structural/co-location.d.ts.map +1 -0
  383. package/dist/structural/co-location.js +640 -0
  384. package/dist/structural/co-location.js.map +1 -0
  385. package/dist/structural/directory-structure.d.ts +151 -0
  386. package/dist/structural/directory-structure.d.ts.map +1 -0
  387. package/dist/structural/directory-structure.js +457 -0
  388. package/dist/structural/directory-structure.js.map +1 -0
  389. package/dist/structural/file-naming.d.ts +61 -0
  390. package/dist/structural/file-naming.d.ts.map +1 -0
  391. package/dist/structural/file-naming.js +231 -0
  392. package/dist/structural/file-naming.js.map +1 -0
  393. package/dist/structural/import-ordering.d.ts +212 -0
  394. package/dist/structural/import-ordering.d.ts.map +1 -0
  395. package/dist/structural/import-ordering.js +821 -0
  396. package/dist/structural/import-ordering.js.map +1 -0
  397. package/dist/structural/index.d.ts +23 -0
  398. package/dist/structural/index.d.ts.map +1 -0
  399. package/dist/structural/index.js +26 -0
  400. package/dist/structural/index.js.map +1 -0
  401. package/dist/structural/module-boundaries.d.ts +164 -0
  402. package/dist/structural/module-boundaries.d.ts.map +1 -0
  403. package/dist/structural/module-boundaries.js +616 -0
  404. package/dist/structural/module-boundaries.js.map +1 -0
  405. package/dist/structural/package-boundaries.d.ts +182 -0
  406. package/dist/structural/package-boundaries.d.ts.map +1 -0
  407. package/dist/structural/package-boundaries.js +602 -0
  408. package/dist/structural/package-boundaries.js.map +1 -0
  409. package/dist/styling/class-naming.d.ts +263 -0
  410. package/dist/styling/class-naming.d.ts.map +1 -0
  411. package/dist/styling/class-naming.js +892 -0
  412. package/dist/styling/class-naming.js.map +1 -0
  413. package/dist/styling/color-usage.d.ts +213 -0
  414. package/dist/styling/color-usage.d.ts.map +1 -0
  415. package/dist/styling/color-usage.js +732 -0
  416. package/dist/styling/color-usage.js.map +1 -0
  417. package/dist/styling/design-tokens.d.ts +212 -0
  418. package/dist/styling/design-tokens.d.ts.map +1 -0
  419. package/dist/styling/design-tokens.js +748 -0
  420. package/dist/styling/design-tokens.js.map +1 -0
  421. package/dist/styling/index.d.ts +16 -0
  422. package/dist/styling/index.d.ts.map +1 -0
  423. package/dist/styling/index.js +56 -0
  424. package/dist/styling/index.js.map +1 -0
  425. package/dist/styling/responsive.d.ts +304 -0
  426. package/dist/styling/responsive.d.ts.map +1 -0
  427. package/dist/styling/responsive.js +888 -0
  428. package/dist/styling/responsive.js.map +1 -0
  429. package/dist/styling/spacing-scale.d.ts +248 -0
  430. package/dist/styling/spacing-scale.d.ts.map +1 -0
  431. package/dist/styling/spacing-scale.js +865 -0
  432. package/dist/styling/spacing-scale.js.map +1 -0
  433. package/dist/styling/tailwind-patterns.d.ts +305 -0
  434. package/dist/styling/tailwind-patterns.d.ts.map +1 -0
  435. package/dist/styling/tailwind-patterns.js +1181 -0
  436. package/dist/styling/tailwind-patterns.js.map +1 -0
  437. package/dist/styling/typography.d.ts +281 -0
  438. package/dist/styling/typography.d.ts.map +1 -0
  439. package/dist/styling/typography.js +1004 -0
  440. package/dist/styling/typography.js.map +1 -0
  441. package/dist/styling/z-index-scale.d.ts +270 -0
  442. package/dist/styling/z-index-scale.d.ts.map +1 -0
  443. package/dist/styling/z-index-scale.js +714 -0
  444. package/dist/styling/z-index-scale.js.map +1 -0
  445. package/dist/testing/co-location.d.ts +42 -0
  446. package/dist/testing/co-location.d.ts.map +1 -0
  447. package/dist/testing/co-location.js +134 -0
  448. package/dist/testing/co-location.js.map +1 -0
  449. package/dist/testing/describe-naming.d.ts +47 -0
  450. package/dist/testing/describe-naming.d.ts.map +1 -0
  451. package/dist/testing/describe-naming.js +150 -0
  452. package/dist/testing/describe-naming.js.map +1 -0
  453. package/dist/testing/file-naming.d.ts +44 -0
  454. package/dist/testing/file-naming.d.ts.map +1 -0
  455. package/dist/testing/file-naming.js +131 -0
  456. package/dist/testing/file-naming.js.map +1 -0
  457. package/dist/testing/fixture-patterns.d.ts +52 -0
  458. package/dist/testing/fixture-patterns.d.ts.map +1 -0
  459. package/dist/testing/fixture-patterns.js +228 -0
  460. package/dist/testing/fixture-patterns.js.map +1 -0
  461. package/dist/testing/index.d.ts +31 -0
  462. package/dist/testing/index.d.ts.map +1 -0
  463. package/dist/testing/index.js +49 -0
  464. package/dist/testing/index.js.map +1 -0
  465. package/dist/testing/mock-patterns.d.ts +53 -0
  466. package/dist/testing/mock-patterns.d.ts.map +1 -0
  467. package/dist/testing/mock-patterns.js +264 -0
  468. package/dist/testing/mock-patterns.js.map +1 -0
  469. package/dist/testing/setup-teardown.d.ts +55 -0
  470. package/dist/testing/setup-teardown.d.ts.map +1 -0
  471. package/dist/testing/setup-teardown.js +262 -0
  472. package/dist/testing/setup-teardown.js.map +1 -0
  473. package/dist/testing/test-structure.d.ts +51 -0
  474. package/dist/testing/test-structure.d.ts.map +1 -0
  475. package/dist/testing/test-structure.js +225 -0
  476. package/dist/testing/test-structure.js.map +1 -0
  477. package/dist/types/any-usage.d.ts +99 -0
  478. package/dist/types/any-usage.d.ts.map +1 -0
  479. package/dist/types/any-usage.js +641 -0
  480. package/dist/types/any-usage.js.map +1 -0
  481. package/dist/types/file-location.d.ts +76 -0
  482. package/dist/types/file-location.d.ts.map +1 -0
  483. package/dist/types/file-location.js +395 -0
  484. package/dist/types/file-location.js.map +1 -0
  485. package/dist/types/generic-patterns.d.ts +97 -0
  486. package/dist/types/generic-patterns.d.ts.map +1 -0
  487. package/dist/types/generic-patterns.js +615 -0
  488. package/dist/types/generic-patterns.js.map +1 -0
  489. package/dist/types/index.d.ts +31 -0
  490. package/dist/types/index.d.ts.map +1 -0
  491. package/dist/types/index.js +43 -0
  492. package/dist/types/index.js.map +1 -0
  493. package/dist/types/interface-vs-type.d.ts +81 -0
  494. package/dist/types/interface-vs-type.d.ts.map +1 -0
  495. package/dist/types/interface-vs-type.js +440 -0
  496. package/dist/types/interface-vs-type.js.map +1 -0
  497. package/dist/types/naming-conventions.d.ts +84 -0
  498. package/dist/types/naming-conventions.d.ts.map +1 -0
  499. package/dist/types/naming-conventions.js +455 -0
  500. package/dist/types/naming-conventions.js.map +1 -0
  501. package/dist/types/type-assertions.d.ts +98 -0
  502. package/dist/types/type-assertions.d.ts.map +1 -0
  503. package/dist/types/type-assertions.js +639 -0
  504. package/dist/types/type-assertions.js.map +1 -0
  505. package/dist/types/utility-types.d.ts +110 -0
  506. package/dist/types/utility-types.d.ts.map +1 -0
  507. package/dist/types/utility-types.js +547 -0
  508. package/dist/types/utility-types.js.map +1 -0
  509. package/package.json +44 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Structured Format Detector - Structured logging format detection
3
+ *
4
+ * Detects structured logging patterns including:
5
+ * - JSON logging
6
+ * - Key-value logging
7
+ * - Logger library usage
8
+ *
9
+ * @requirements 15.1 - Structured logging format patterns
10
+ */
11
+ import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
12
+ import { RegexDetector } from '../base/regex-detector.js';
13
+ import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
14
+ export type StructuredFormatPatternType = 'json-logging' | 'key-value-logging' | 'winston-logger' | 'pino-logger' | 'bunyan-logger' | 'console-log';
15
+ export interface StructuredFormatPatternInfo {
16
+ type: StructuredFormatPatternType;
17
+ line: number;
18
+ column: number;
19
+ match: string;
20
+ library?: string | undefined;
21
+ }
22
+ export interface StructuredFormatAnalysis {
23
+ patterns: StructuredFormatPatternInfo[];
24
+ hasStructuredLogging: boolean;
25
+ dominantLibrary: string | null;
26
+ consoleLogCount: number;
27
+ }
28
+ export declare const JSON_LOGGING_PATTERNS: RegExp[];
29
+ export declare const KEY_VALUE_LOGGING_PATTERNS: RegExp[];
30
+ export declare const WINSTON_PATTERNS: RegExp[];
31
+ export declare const PINO_PATTERNS: RegExp[];
32
+ export declare const BUNYAN_PATTERNS: RegExp[];
33
+ export declare const PYTHON_STRUCTLOG_PATTERNS: RegExp[];
34
+ export declare const PYTHON_LOGURU_PATTERNS: RegExp[];
35
+ export declare const CONSOLE_LOG_PATTERNS: RegExp[];
36
+ export declare function shouldExcludeFile(filePath: string): boolean;
37
+ export declare function detectJSONLogging(content: string): StructuredFormatPatternInfo[];
38
+ export declare function detectWinstonLogger(content: string): StructuredFormatPatternInfo[];
39
+ export declare function detectPinoLogger(content: string): StructuredFormatPatternInfo[];
40
+ export declare function detectConsoleLog(content: string): StructuredFormatPatternInfo[];
41
+ export declare function analyzeStructuredFormat(content: string, filePath: string): StructuredFormatAnalysis;
42
+ export declare class StructuredFormatDetector extends RegexDetector {
43
+ readonly id = "logging/structured-format";
44
+ readonly name = "Structured Format Detector";
45
+ readonly description = "Detects structured logging format patterns";
46
+ readonly category: PatternCategory;
47
+ readonly subcategory = "structured-format";
48
+ readonly supportedLanguages: Language[];
49
+ detect(context: DetectionContext): Promise<DetectionResult>;
50
+ generateQuickFix(_violation: Violation): QuickFix | null;
51
+ }
52
+ export declare function createStructuredFormatDetector(): StructuredFormatDetector;
53
+ //# sourceMappingURL=structured-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-format.d.ts","sourceRoot":"","sources":["../../src/logging/structured-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMlF,MAAM,MAAM,2BAA2B,GACnC,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,GACb,eAAe,GACf,aAAa,CAAC;AAElB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,2BAA2B,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;CACzB;AAMD,eAAO,MAAM,qBAAqB,UAQjC,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAOtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAI5B,CAAC;AAEF,eAAO,MAAM,aAAa,UAIzB,CAAC;AAEF,eAAO,MAAM,eAAe,UAG3B,CAAC;AAGF,eAAO,MAAM,yBAAyB,UAKrC,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAGlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAShC,CAAC;AAMF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAS3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,EAAE,CAqBhF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,EAAE,CAsBlF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,EAAE,CAsB/E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,EAAE,CAqB/E;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,wBAAwB,CA4CnG;AAMD,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,QAAQ,CAAC,EAAE,+BAA+B;IAC1C,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,QAAQ,CAAC,WAAW,gDAAgD;IACpE,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAa;IAC/C,QAAQ,CAAC,WAAW,uBAAuB;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAA0C;IAE3E,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsBjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CAGzD;AAED,wBAAgB,8BAA8B,IAAI,wBAAwB,CAEzE"}
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Structured Format Detector - Structured logging format detection
3
+ *
4
+ * Detects structured logging patterns including:
5
+ * - JSON logging
6
+ * - Key-value logging
7
+ * - Logger library usage
8
+ *
9
+ * @requirements 15.1 - Structured logging format patterns
10
+ */
11
+ import { RegexDetector } from '../base/regex-detector.js';
12
+ // ============================================================================
13
+ // Patterns (JavaScript/TypeScript + Python)
14
+ // ============================================================================
15
+ export const JSON_LOGGING_PATTERNS = [
16
+ // JavaScript/TypeScript
17
+ /logger\.\w+\s*\(\s*\{/gi,
18
+ /log\.\w+\s*\(\s*\{/gi,
19
+ /JSON\.stringify\s*\([^)]*log/gi,
20
+ // Python - dict/extra logging
21
+ /logger\.\w+\s*\([^)]+,\s*extra\s*=/gi,
22
+ /logging\.\w+\s*\([^)]+,\s*extra\s*=/gi,
23
+ ];
24
+ export const KEY_VALUE_LOGGING_PATTERNS = [
25
+ // JavaScript/TypeScript
26
+ /logger\.\w+\s*\([^)]*,\s*\{/gi,
27
+ /log\.\w+\s*\([^)]*,\s*\{/gi,
28
+ // Python - f-string structured logging
29
+ /logger\.\w+\s*\(\s*f['"]/gi,
30
+ /logging\.\w+\s*\(\s*f['"]/gi,
31
+ ];
32
+ export const WINSTON_PATTERNS = [
33
+ /winston\.createLogger/gi,
34
+ /winston\.\w+\s*\(/gi,
35
+ /import.*winston/gi,
36
+ ];
37
+ export const PINO_PATTERNS = [
38
+ /pino\s*\(/gi,
39
+ /import.*pino/gi,
40
+ /require\s*\(\s*['"`]pino['"`]\s*\)/gi,
41
+ ];
42
+ export const BUNYAN_PATTERNS = [
43
+ /bunyan\.createLogger/gi,
44
+ /import.*bunyan/gi,
45
+ ];
46
+ // Python logging libraries
47
+ export const PYTHON_STRUCTLOG_PATTERNS = [
48
+ /structlog\.get_logger/gi,
49
+ /structlog\.configure/gi,
50
+ /import\s+structlog/gi,
51
+ /from\s+structlog/gi,
52
+ ];
53
+ export const PYTHON_LOGURU_PATTERNS = [
54
+ /from\s+loguru\s+import/gi,
55
+ /loguru\.logger/gi,
56
+ ];
57
+ export const CONSOLE_LOG_PATTERNS = [
58
+ // JavaScript/TypeScript
59
+ /console\.log\s*\(/gi,
60
+ /console\.info\s*\(/gi,
61
+ /console\.warn\s*\(/gi,
62
+ /console\.error\s*\(/gi,
63
+ /console\.debug\s*\(/gi,
64
+ // Python print (anti-pattern in production)
65
+ /print\s*\(/gi,
66
+ ];
67
+ // ============================================================================
68
+ // Analysis Functions
69
+ // ============================================================================
70
+ export function shouldExcludeFile(filePath) {
71
+ const excludePatterns = [
72
+ /\.test\.[jt]sx?$/,
73
+ /\.spec\.[jt]sx?$/,
74
+ /__tests__\//,
75
+ /\.d\.ts$/,
76
+ /node_modules\//,
77
+ ];
78
+ return excludePatterns.some((p) => p.test(filePath));
79
+ }
80
+ export function detectJSONLogging(content) {
81
+ const results = [];
82
+ const lines = content.split('\n');
83
+ for (let i = 0; i < lines.length; i++) {
84
+ const line = lines[i];
85
+ for (const pattern of JSON_LOGGING_PATTERNS) {
86
+ const regex = new RegExp(pattern.source, pattern.flags);
87
+ let match;
88
+ while ((match = regex.exec(line)) !== null) {
89
+ results.push({
90
+ type: 'json-logging',
91
+ line: i + 1,
92
+ column: match.index + 1,
93
+ match: match[0],
94
+ });
95
+ }
96
+ }
97
+ }
98
+ return results;
99
+ }
100
+ export function detectWinstonLogger(content) {
101
+ const results = [];
102
+ const lines = content.split('\n');
103
+ for (let i = 0; i < lines.length; i++) {
104
+ const line = lines[i];
105
+ for (const pattern of WINSTON_PATTERNS) {
106
+ const regex = new RegExp(pattern.source, pattern.flags);
107
+ let match;
108
+ while ((match = regex.exec(line)) !== null) {
109
+ results.push({
110
+ type: 'winston-logger',
111
+ line: i + 1,
112
+ column: match.index + 1,
113
+ match: match[0],
114
+ library: 'winston',
115
+ });
116
+ }
117
+ }
118
+ }
119
+ return results;
120
+ }
121
+ export function detectPinoLogger(content) {
122
+ const results = [];
123
+ const lines = content.split('\n');
124
+ for (let i = 0; i < lines.length; i++) {
125
+ const line = lines[i];
126
+ for (const pattern of PINO_PATTERNS) {
127
+ const regex = new RegExp(pattern.source, pattern.flags);
128
+ let match;
129
+ while ((match = regex.exec(line)) !== null) {
130
+ results.push({
131
+ type: 'pino-logger',
132
+ line: i + 1,
133
+ column: match.index + 1,
134
+ match: match[0],
135
+ library: 'pino',
136
+ });
137
+ }
138
+ }
139
+ }
140
+ return results;
141
+ }
142
+ export function detectConsoleLog(content) {
143
+ const results = [];
144
+ const lines = content.split('\n');
145
+ for (let i = 0; i < lines.length; i++) {
146
+ const line = lines[i];
147
+ for (const pattern of CONSOLE_LOG_PATTERNS) {
148
+ const regex = new RegExp(pattern.source, pattern.flags);
149
+ let match;
150
+ while ((match = regex.exec(line)) !== null) {
151
+ results.push({
152
+ type: 'console-log',
153
+ line: i + 1,
154
+ column: match.index + 1,
155
+ match: match[0],
156
+ });
157
+ }
158
+ }
159
+ }
160
+ return results;
161
+ }
162
+ export function analyzeStructuredFormat(content, filePath) {
163
+ if (shouldExcludeFile(filePath)) {
164
+ return {
165
+ patterns: [],
166
+ hasStructuredLogging: false,
167
+ dominantLibrary: null,
168
+ consoleLogCount: 0,
169
+ };
170
+ }
171
+ const patterns = [
172
+ ...detectJSONLogging(content),
173
+ ...detectWinstonLogger(content),
174
+ ...detectPinoLogger(content),
175
+ ...detectConsoleLog(content),
176
+ ];
177
+ const libraryCounts = new Map();
178
+ for (const pattern of patterns) {
179
+ if (pattern.library) {
180
+ libraryCounts.set(pattern.library, (libraryCounts.get(pattern.library) || 0) + 1);
181
+ }
182
+ }
183
+ let dominantLibrary = null;
184
+ let maxCount = 0;
185
+ for (const [lib, count] of libraryCounts) {
186
+ if (count > maxCount) {
187
+ maxCount = count;
188
+ dominantLibrary = lib;
189
+ }
190
+ }
191
+ const hasStructuredLogging = patterns.some((p) => p.type === 'json-logging' || p.type === 'winston-logger' || p.type === 'pino-logger');
192
+ const consoleLogCount = patterns.filter((p) => p.type === 'console-log').length;
193
+ return {
194
+ patterns,
195
+ hasStructuredLogging,
196
+ dominantLibrary,
197
+ consoleLogCount,
198
+ };
199
+ }
200
+ // ============================================================================
201
+ // Detector Class
202
+ // ============================================================================
203
+ export class StructuredFormatDetector extends RegexDetector {
204
+ id = 'logging/structured-format';
205
+ name = 'Structured Format Detector';
206
+ description = 'Detects structured logging format patterns';
207
+ category = 'logging';
208
+ subcategory = 'structured-format';
209
+ supportedLanguages = ['typescript', 'javascript', 'python'];
210
+ async detect(context) {
211
+ if (!this.supportsLanguage(context.language)) {
212
+ return this.createEmptyResult();
213
+ }
214
+ const analysis = analyzeStructuredFormat(context.content, context.file);
215
+ if (analysis.patterns.length === 0) {
216
+ return this.createEmptyResult();
217
+ }
218
+ const confidence = analysis.hasStructuredLogging ? 0.9 : 0.7;
219
+ return this.createResult([], [], confidence, {
220
+ custom: {
221
+ patterns: analysis.patterns,
222
+ hasStructuredLogging: analysis.hasStructuredLogging,
223
+ dominantLibrary: analysis.dominantLibrary,
224
+ consoleLogCount: analysis.consoleLogCount,
225
+ },
226
+ });
227
+ }
228
+ generateQuickFix(_violation) {
229
+ return null;
230
+ }
231
+ }
232
+ export function createStructuredFormatDetector() {
233
+ return new StructuredFormatDetector();
234
+ }
235
+ //# sourceMappingURL=structured-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-format.js","sourceRoot":"","sources":["../../src/logging/structured-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA8B1D,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,wBAAwB;IACxB,yBAAyB;IACzB,sBAAsB;IACtB,gCAAgC;IAChC,8BAA8B;IAC9B,sCAAsC;IACtC,uCAAuC;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,wBAAwB;IACxB,+BAA+B;IAC/B,4BAA4B;IAC5B,uCAAuC;IACvC,4BAA4B;IAC5B,6BAA6B;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa;IACb,gBAAgB;IAChB,sCAAsC;CACvC,CAAC;AAEF,MAAM,CA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C,CAAC;QAExE,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAClC,CAAC;QAED,MAAM,UAAU,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7D,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE;YAC3C,MAAM,EAAE;gBACN,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB;gBACnD,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,eAAe,EAAE,QAAQ,CAAC,eAAe;aAC1C;SACF,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,UAAqB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO,IAAI,wBAAwB,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Bundle Size Detector - Bundle size optimization pattern detection
3
+ *
4
+ * Detects bundle size patterns including:
5
+ * - Tree shaking imports
6
+ * - Large library imports
7
+ * - Side effect imports
8
+ * - Bundle analyzer usage
9
+ * - Code splitting hints
10
+ *
11
+ * @requirements 19.6 - Bundle size patterns
12
+ */
13
+ import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
14
+ import { RegexDetector } from '../base/regex-detector.js';
15
+ import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
16
+ export type BundleSizePatternType = 'tree-shakeable-import' | 'namespace-import' | 'side-effect-import' | 'dynamic-import' | 'external-config' | 'bundle-analyzer' | 'source-map-config';
17
+ export type BundleSizeViolationType = 'large-library-import' | 'full-lodash-import' | 'moment-import' | 'barrel-import' | 'unused-import';
18
+ export interface BundleSizePatternInfo {
19
+ type: BundleSizePatternType;
20
+ file: string;
21
+ line: number;
22
+ column: number;
23
+ matchedText: string;
24
+ library?: string | undefined;
25
+ context?: string | undefined;
26
+ }
27
+ export interface BundleSizeViolationInfo {
28
+ type: BundleSizeViolationType;
29
+ file: string;
30
+ line: number;
31
+ column: number;
32
+ matchedText: string;
33
+ issue: string;
34
+ suggestedFix?: string | undefined;
35
+ severity: 'high' | 'medium' | 'low';
36
+ }
37
+ export interface BundleSizeAnalysis {
38
+ patterns: BundleSizePatternInfo[];
39
+ violations: BundleSizeViolationInfo[];
40
+ treeShakeableCount: number;
41
+ namespaceImportCount: number;
42
+ dynamicImportCount: number;
43
+ confidence: number;
44
+ }
45
+ export declare const TREE_SHAKEABLE_IMPORT_PATTERNS: readonly [RegExp, RegExp];
46
+ export declare const NAMESPACE_IMPORT_PATTERNS: readonly [RegExp];
47
+ export declare const SIDE_EFFECT_IMPORT_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
48
+ export declare const DYNAMIC_IMPORT_PATTERNS: readonly [RegExp, RegExp];
49
+ export declare const EXTERNAL_CONFIG_PATTERNS: readonly [RegExp, RegExp, RegExp];
50
+ export declare const BUNDLE_ANALYZER_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
51
+ export declare const SOURCE_MAP_CONFIG_PATTERNS: readonly [RegExp, RegExp, RegExp];
52
+ export declare const LARGE_LIBRARY_IMPORT_PATTERNS: readonly [RegExp, RegExp, RegExp];
53
+ export declare const FULL_LODASH_IMPORT_PATTERNS: readonly [RegExp, RegExp, RegExp];
54
+ export declare const MOMENT_IMPORT_PATTERNS: readonly [RegExp, RegExp, RegExp];
55
+ export declare const BARREL_IMPORT_PATTERNS: readonly [RegExp, RegExp];
56
+ export declare function shouldExcludeFile(filePath: string): boolean;
57
+ export declare function detectTreeShakeableImport(content: string, filePath: string): BundleSizePatternInfo[];
58
+ export declare function detectNamespaceImport(content: string, filePath: string): BundleSizePatternInfo[];
59
+ export declare function detectSideEffectImport(content: string, filePath: string): BundleSizePatternInfo[];
60
+ export declare function detectDynamicImport(content: string, filePath: string): BundleSizePatternInfo[];
61
+ export declare function detectExternalConfig(content: string, filePath: string): BundleSizePatternInfo[];
62
+ export declare function detectBundleAnalyzer(content: string, filePath: string): BundleSizePatternInfo[];
63
+ export declare function detectSourceMapConfig(content: string, filePath: string): BundleSizePatternInfo[];
64
+ export declare function detectFullLodashImportViolations(content: string, filePath: string): BundleSizeViolationInfo[];
65
+ export declare function detectMomentImportViolations(content: string, filePath: string): BundleSizeViolationInfo[];
66
+ export declare function detectBarrelImportViolations(content: string, filePath: string): BundleSizeViolationInfo[];
67
+ export declare function analyzeBundleSize(content: string, filePath: string): BundleSizeAnalysis;
68
+ export declare class BundleSizeDetector extends RegexDetector {
69
+ readonly id = "performance/bundle-size";
70
+ readonly name = "Bundle Size Detector";
71
+ readonly description = "Detects bundle size optimization patterns and violations";
72
+ readonly category: PatternCategory;
73
+ readonly subcategory = "bundle-size";
74
+ readonly supportedLanguages: Language[];
75
+ detect(context: DetectionContext): Promise<DetectionResult>;
76
+ generateQuickFix(_violation: Violation): QuickFix | null;
77
+ }
78
+ export declare function createBundleSizeDetector(): BundleSizeDetector;
79
+ //# sourceMappingURL=bundle-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-size.d.ts","sourceRoot":"","sources":["../../src/performance/bundle-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMlF,MAAM,MAAM,qBAAqB,GAC7B,uBAAuB,GACvB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,CAAC;A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C/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,kBAAkB,CA6CpB;AAMD,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,QAAQ,CAAC,EAAE,6BAA6B;IACxC,QAAQ,CAAC,IAAI,0BAA0B;IACvC,QAAQ,CAAC,WAAW,8DAA8D;IAClF,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAiB;IACnD,QAAQ,CAAC,WAAW,iBAAiB;IACrC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAgC;IAEjE,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsBjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CAGzD;AAED,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Bundle Size Detector - Bundle size optimization pattern detection
3
+ *
4
+ * Detects bundle size patterns including:
5
+ * - Tree shaking imports
6
+ * - Large library imports
7
+ * - Side effect imports
8
+ * - Bundle analyzer usage
9
+ * - Code splitting hints
10
+ *
11
+ * @requirements 19.6 - Bundle size patterns
12
+ */
13
+ import { RegexDetector } from '../base/regex-detector.js';
14
+ // ============================================================================
15
+ // Constants
16
+ // ============================================================================
17
+ export const TREE_SHAKEABLE_IMPORT_PATTERNS = [
18
+ /import\s+\{\s*\w+(?:\s*,\s*\w+)*\s*\}\s+from/g,
19
+ /import\s+\{\s*\w+\s+as\s+\w+\s*\}\s+from/g,
20
+ ];
21
+ export const NAMESPACE_IMPORT_PATTERNS = [
22
+ /import\s+\*\s+as\s+\w+\s+from/g,
23
+ ];
24
+ export const SIDE_EFFECT_IMPORT_PATTERNS = [
25
+ /import\s+['"`][^'"`]+\.css['"`]/g,
26
+ /import\s+['"`][^'"`]+\.scss['"`]/g,
27
+ /import\s+['"`][^'"`]+\.less['"`]/g,
28
+ /import\s+['"`]@?[^'"`]+\/styles['"`]/g,
29
+ ];
30
+ export const DYNAMIC_IMPORT_PATTERNS = [
31
+ /import\s*\(\s*['"`][^'"`]+['"`]\s*\)/g,
32
+ /await\s+import\s*\(/g,
33
+ ];
34
+ export const EXTERNAL_CONFIG_PATTERNS = [
35
+ /externals\s*:/g,
36
+ /external\s*:/g,
37
+ /rollupOptions.*external/g,
38
+ ];
39
+ export const BUNDLE_ANALYZER_PATTERNS = [
40
+ /webpack-bundle-analyzer/g,
41
+ /rollup-plugin-visualizer/g,
42
+ /source-map-explorer/g,
43
+ /bundle-stats/g,
44
+ /BundleAnalyzerPlugin/g,
45
+ ];
46
+ export const SOURCE_MAP_CONFIG_PATTERNS = [
47
+ /devtool\s*:\s*['"`][^'"`]+['"`]/g,
48
+ /sourcemap\s*:\s*(?:true|false|['"`]\w+['"`])/g,
49
+ /sourceMap\s*:\s*(?:true|false)/g,
50
+ ];
51
+ export const LARGE_LIBRARY_IMPORT_PATTERNS = [
52
+ /import\s+\w+\s+from\s+['"`]lodash['"`]/g,
53
+ /import\s+\*\s+as\s+_\s+from\s+['"`]lodash['"`]/g,
54
+ /import\s+_\s+from\s+['"`]lodash['"`]/g,
55
+ ];
56
+ export const FULL_LODASH_IMPORT_PATTERNS = [
57
+ /import\s+_\s+from\s+['"`]lodash['"`]/g,
58
+ /import\s+\*\s+as\s+_\s+from\s+['"`]lodash['"`]/g,
59
+ /require\s*\(\s*['"`]lodash['"`]\s*\)/g,
60
+ ];
61
+ export const MOMENT_IMPORT_PATTERNS = [
62
+ /import\s+moment\s+from\s+['"`]moment['"`]/g,
63
+ /import\s+\*\s+as\s+moment\s+from\s+['"`]moment['"`]/g,
64
+ /require\s*\(\s*['"`]moment['"`]\s*\)/g,
65
+ ];
66
+ export const BARREL_IMPORT_PATTERNS = [
67
+ /from\s+['"`]\.\.?\/index['"`]/g,
68
+ /from\s+['"`]\.\.?\/['"`]/g,
69
+ ];
70
+ // ============================================================================
71
+ // Analysis Functions
72
+ // ============================================================================
73
+ export function shouldExcludeFile(filePath) {
74
+ const excludePatterns = [
75
+ /\.test\.[jt]sx?$/,
76
+ /\.spec\.[jt]sx?$/,
77
+ /__tests__\//,
78
+ /node_modules\//,
79
+ /\.min\.[jt]s$/,
80
+ ];
81
+ return excludePatterns.some((p) => p.test(filePath));
82
+ }
83
+ function detectPatterns(content, filePath, patterns, type) {
84
+ const results = [];
85
+ const lines = content.split('\n');
86
+ for (let i = 0; i < lines.length; i++) {
87
+ const line = lines[i];
88
+ for (const pattern of patterns) {
89
+ const regex = new RegExp(pattern.source, pattern.flags);
90
+ let match;
91
+ while ((match = regex.exec(line)) !== null) {
92
+ results.push({
93
+ type,
94
+ file: filePath,
95
+ line: i + 1,
96
+ column: match.index + 1,
97
+ matchedText: match[0],
98
+ context: line.trim(),
99
+ });
100
+ }
101
+ }
102
+ }
103
+ return results;
104
+ }
105
+ export function detectTreeShakeableImport(content, filePath) {
106
+ return detectPatterns(content, filePath, TREE_SHAKEABLE_IMPORT_PATTERNS, 'tree-shakeable-import');
107
+ }
108
+ export function detectNamespaceImport(content, filePath) {
109
+ return detectPatterns(content, filePath, NAMESPACE_IMPORT_PATTERNS, 'namespace-import');
110
+ }
111
+ export function detectSideEffectImport(content, filePath) {
112
+ return detectPatterns(content, filePath, SIDE_EFFECT_IMPORT_PATTERNS, 'side-effect-import');
113
+ }
114
+ export function detectDynamicImport(content, filePath) {
115
+ return detectPatterns(content, filePath, DYNAMIC_IMPORT_PATTERNS, 'dynamic-import');
116
+ }
117
+ export function detectExternalConfig(content, filePath) {
118
+ return detectPatterns(content, filePath, EXTERNAL_CONFIG_PATTERNS, 'external-config');
119
+ }
120
+ export function detectBundleAnalyzer(content, filePath) {
121
+ return detectPatterns(content, filePath, BUNDLE_ANALYZER_PATTERNS, 'bundle-analyzer');
122
+ }
123
+ export function detectSourceMapConfig(content, filePath) {
124
+ return detectPatterns(content, filePath, SOURCE_MAP_CONFIG_PATTERNS, 'source-map-config');
125
+ }
126
+ export function detectFullLodashImportViolations(content, filePath) {
127
+ const results = [];
128
+ const lines = content.split('\n');
129
+ for (let i = 0; i < lines.length; i++) {
130
+ const line = lines[i];
131
+ for (const pattern of FULL_LODASH_IMPORT_PATTERNS) {
132
+ const regex = new RegExp(pattern.source, pattern.flags);
133
+ let match;
134
+ while ((match = regex.exec(line)) !== null) {
135
+ results.push({
136
+ type: 'full-lodash-import',
137
+ file: filePath,
138
+ line: i + 1,
139
+ column: match.index + 1,
140
+ matchedText: match[0],
141
+ issue: 'Full lodash import increases bundle size significantly',
142
+ suggestedFix: 'Use lodash-es or import specific functions: import { debounce } from "lodash"',
143
+ severity: 'high',
144
+ });
145
+ }
146
+ }
147
+ }
148
+ return results;
149
+ }
150
+ export function detectMomentImportViolations(content, filePath) {
151
+ const results = [];
152
+ const lines = content.split('\n');
153
+ for (let i = 0; i < lines.length; i++) {
154
+ const line = lines[i];
155
+ for (const pattern of MOMENT_IMPORT_PATTERNS) {
156
+ const regex = new RegExp(pattern.source, pattern.flags);
157
+ let match;
158
+ while ((match = regex.exec(line)) !== null) {
159
+ results.push({
160
+ type: 'moment-import',
161
+ file: filePath,
162
+ line: i + 1,
163
+ column: match.index + 1,
164
+ matchedText: match[0],
165
+ issue: 'Moment.js is large (~300KB). Consider alternatives',
166
+ suggestedFix: 'Use date-fns, dayjs, or native Intl API',
167
+ severity: 'medium',
168
+ });
169
+ }
170
+ }
171
+ }
172
+ return results;
173
+ }
174
+ export function detectBarrelImportViolations(content, filePath) {
175
+ const results = [];
176
+ const lines = content.split('\n');
177
+ for (let i = 0; i < lines.length; i++) {
178
+ const line = lines[i];
179
+ for (const pattern of BARREL_IMPORT_PATTERNS) {
180
+ const regex = new RegExp(pattern.source, pattern.flags);
181
+ let match;
182
+ while ((match = regex.exec(line)) !== null) {
183
+ results.push({
184
+ type: 'barrel-import',
185
+ file: filePath,
186
+ line: i + 1,
187
+ column: match.index + 1,
188
+ matchedText: match[0],
189
+ issue: 'Barrel imports may prevent tree shaking',
190
+ suggestedFix: 'Import directly from the source file',
191
+ severity: 'low',
192
+ });
193
+ }
194
+ }
195
+ }
196
+ return results;
197
+ }
198
+ export function analyzeBundleSize(content, filePath) {
199
+ if (shouldExcludeFile(filePath)) {
200
+ return {
201
+ patterns: [],
202
+ violations: [],
203
+ treeShakeableCount: 0,
204
+ namespaceImportCount: 0,
205
+ dynamicImportCount: 0,
206
+ confidence: 1.0,
207
+ };
208
+ }
209
+ const patterns = [
210
+ ...detectTreeShakeableImport(content, filePath),
211
+ ...detectNamespaceImport(content, filePath),
212
+ ...detectSideEffectImport(content, filePath),
213
+ ...detectDynamicImport(content, filePath),
214
+ ...detectExternalConfig(content, filePath),
215
+ ...detectBundleAnalyzer(content, filePath),
216
+ ...detectSourceMapConfig(content, filePath),
217
+ ];
218
+ const violations = [
219
+ ...detectFullLodashImportViolations(content, filePath),
220
+ ...detectMomentImportViolations(content, filePath),
221
+ ...detectBarrelImportViolations(content, filePath),
222
+ ];
223
+ const treeShakeableCount = patterns.filter((p) => p.type === 'tree-shakeable-import').length;
224
+ const namespaceImportCount = patterns.filter((p) => p.type === 'namespace-import').length;
225
+ const dynamicImportCount = patterns.filter((p) => p.type === 'dynamic-import').length;
226
+ let confidence = 0.7;
227
+ if (patterns.length > 0)
228
+ confidence += 0.15;
229
+ if (violations.length === 0)
230
+ confidence += 0.1;
231
+ confidence = Math.min(confidence, 0.95);
232
+ return {
233
+ patterns,
234
+ violations,
235
+ treeShakeableCount,
236
+ namespaceImportCount,
237
+ dynamicImportCount,
238
+ confidence,
239
+ };
240
+ }
241
+ // ============================================================================
242
+ // Detector Class
243
+ // ============================================================================
244
+ export class BundleSizeDetector extends RegexDetector {
245
+ id = 'performance/bundle-size';
246
+ name = 'Bundle Size Detector';
247
+ description = 'Detects bundle size optimization patterns and violations';
248
+ category = 'performance';
249
+ subcategory = 'bundle-size';
250
+ supportedLanguages = ['typescript', 'javascript'];
251
+ async detect(context) {
252
+ if (!this.supportsLanguage(context.language)) {
253
+ return this.createEmptyResult();
254
+ }
255
+ const analysis = analyzeBundleSize(context.content, context.file);
256
+ if (analysis.patterns.length === 0 && analysis.violations.length === 0) {
257
+ return this.createEmptyResult();
258
+ }
259
+ return this.createResult([], [], analysis.confidence, {
260
+ custom: {
261
+ patterns: analysis.patterns,
262
+ violations: analysis.violations,
263
+ treeShakeableCount: analysis.treeShakeableCount,
264
+ namespaceImportCount: analysis.namespaceImportCount,
265
+ dynamicImportCount: analysis.dynamicImportCount,
266
+ },
267
+ });
268
+ }
269
+ generateQuickFix(_violation) {
270
+ return null;
271
+ }
272
+ }
273
+ export function createBundleSizeDetector() {
274
+ return new BundleSizeDetector();
275
+ }
276
+ //# sourceMappingURL=bundle-size.js.map