xploitscan-shared-rules 2.4.15 → 2.4.16

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.d.cts CHANGED
@@ -165,7 +165,7 @@ interface CustomRule {
165
165
  * before a scan can be saved without enough provenance to explain a changed
166
166
  * grade.
167
167
  */
168
- declare const SCANNER_VERSION = "2.4.15";
168
+ declare const SCANNER_VERSION = "2.4.16";
169
169
 
170
170
  /**
171
171
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
package/dist/index.d.ts CHANGED
@@ -165,7 +165,7 @@ interface CustomRule {
165
165
  * before a scan can be saved without enough provenance to explain a changed
166
166
  * grade.
167
167
  */
168
- declare const SCANNER_VERSION = "2.4.15";
168
+ declare const SCANNER_VERSION = "2.4.16";
169
169
 
170
170
  /**
171
171
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SCANNER_VERSION = "2.4.15";
2
+ var SCANNER_VERSION = "2.4.16";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -6664,15 +6664,17 @@ function isExcludedPath(path) {
6664
6664
  if (/(?:^|\/)(?:migrations?|seeds?|scripts?)\//i.test(path)) return true;
6665
6665
  return false;
6666
6666
  }
6667
+ var USE_CLIENT_DIRECTIVE = /^[^\S\n\r\u2028\u2029]*["']use client["']/m;
6668
+ var USE_SERVER_DIRECTIVE = /^[^\S\n\r\u2028\u2029]*["']use server["']/m;
6667
6669
  function looksClient(code) {
6668
- if (/^\s*["']use client["']/m.test(code)) return true;
6670
+ if (USE_CLIENT_DIRECTIVE.test(code)) return true;
6669
6671
  return /\b(?:useState|useEffect|useTransition|useReducer)\s*\(/.test(code);
6670
6672
  }
6671
6673
  function looksServer(path, code) {
6672
6674
  if (/(?:^|\/)route\.(?:ts|js)$/.test(path)) return true;
6673
6675
  if (/(?:^|\/)middleware\.(?:ts|js)$/.test(path)) return true;
6674
6676
  if (/(?:^|\/)(?:api|server|functions|edge-functions)\//.test(path)) return true;
6675
- if (/^\s*["']use server["']/m.test(code)) return true;
6677
+ if (USE_SERVER_DIRECTIVE.test(code)) return true;
6676
6678
  if (/\bDeno\s*\.\s*serve\s*\(/.test(code)) return true;
6677
6679
  if (/\bserve\s*\(\s*(?:async\s*)?\(/.test(code) && /deno\.land|@std\/http/i.test(code)) return true;
6678
6680
  if (/\bexport\s+(?:async\s+)?function\s+(?:GET|POST|PUT|PATCH|DELETE|HEAD)\s*\(/.test(code)) return true;
@@ -7156,7 +7158,7 @@ var silentFailedWrite = {
7156
7158
  if (!file.isClient) continue;
7157
7159
  if (file.isServer) continue;
7158
7160
  if (NEVER_CLIENT_PATH.test(file.path)) continue;
7159
- if (/^\s*["']use server["']/m.test(file.code)) continue;
7161
+ if (USE_SERVER_DIRECTIVE.test(file.code)) continue;
7160
7162
  const parsed = file.parsed;
7161
7163
  if (!parsed) continue;
7162
7164
  const { reachable } = collectFunctions(file);
@@ -9110,7 +9112,7 @@ var failedReadEmptyState = {
9110
9112
  if (file.excluded) continue;
9111
9113
  if (!file.isClient) continue;
9112
9114
  if (file.isServer) continue;
9113
- if (/^\s*["']use server["']/m.test(file.code)) continue;
9115
+ if (USE_SERVER_DIRECTIVE.test(file.code)) continue;
9114
9116
  if (!file.code.includes("fetch")) continue;
9115
9117
  const parsed = file.parsed;
9116
9118
  if (!parsed) continue;